[IMP] oow init : new option --postgresql-version

This commit is contained in:
Sylvain LE GAL 2024-03-22 17:52:58 +01:00
parent 908a38ab81
commit a11d137eed
5 changed files with 24 additions and 6 deletions

View File

@ -0,0 +1,2 @@
Add a new option ``--postgresql-version`` in ``oow init`` command to
define the version of the postgresql image to be used for the project.

View File

@ -36,6 +36,15 @@ from odoo_openupgrade_wizard.tools.tools_system import (
prompt=True,
type=click.Choice(get_version_options("final")),
)
@click.option(
"--postgresql-version",
required=True,
help="The version of postgresql that will be used"
" to create the postgresql container.Ex : '9.1', '16', ..."
" The version should be available in docker hub."
" (https://hub.docker.com/_/postgres)"
" avoid the 'latest' version if you want a deterministic installation.",
)
@click.option(
"--extra-repository",
"extra_repository_list",
@ -45,7 +54,12 @@ from odoo_openupgrade_wizard.tools.tools_system import (
)
@click.pass_context
def init(
ctx, project_name, initial_version, final_version, extra_repository_list
ctx,
project_name,
initial_version,
final_version,
postgresql_version,
extra_repository_list,
):
"""Initialize OOW Environment based on the initial and
the final version of Odoo you want to migrate.
@ -112,6 +126,7 @@ def init(
ctx.obj["config_file_path"],
"config.yml.j2",
project_name=project_name,
postgresql_version=postgresql_version,
steps=steps,
odoo_versions=odoo_versions,
)

View File

@ -1,9 +1,9 @@
project_name: {{ project_name }}
postgres_image_name: postgres:13
postgres_container_name: {{project_name}}-container-postgres
postgres_volume_name: {{project_name}}-volume-postgres
postgres_image_name: postgres:{{postgresql_version}}
postgres_container_name: {{project_name}}-container-postgres-{{postgresql_version}}
postgres_volume_name: {{project_name}}-volume-postgres-{{postgresql_version}}
postgres_extra_settings:

View File

@ -16,6 +16,7 @@ def test_cli_init():
"--project-name=test-cli",
"--initial-version=14.0",
"--final-version=15.0",
"--postgresql-version=13",
"--extra-repository="
"OCA/web,OCA/server-tools,OCA/bank-statement-import",
],

View File

@ -2,8 +2,8 @@ project_name: test-cli
postgres_image_name: postgres:13
postgres_container_name: test-cli-container-postgres
postgres_volume_name: test-cli-volume-postgres
postgres_container_name: test-cli-container-postgres-13
postgres_volume_name: test-cli-volume-postgres-13
postgres_extra_settings: