add database name to container name

This commit is contained in:
hugues de keyzer 2024-04-10 17:15:21 +02:00
parent 93dc52ee5f
commit 58bc87380d
5 changed files with 17 additions and 15 deletions

View File

@ -142,5 +142,5 @@ def generate_module_analysis(ctx, step, database, modules):
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
logger.info("Received Keyboard Interrupt or System Exiting...") logger.info("Received Keyboard Interrupt or System Exiting...")
finally: finally:
kill_odoo(ctx, initial_step) kill_odoo(ctx, initial_database, initial_step)
kill_odoo(ctx, final_step) kill_odoo(ctx, final_database, final_step)

View File

@ -79,4 +79,4 @@ def install_from_csv(ctx, database, with_demo):
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
logger.info("Received Keyboard Interrupt or System Exiting...") logger.info("Received Keyboard Interrupt or System Exiting...")
finally: finally:
kill_odoo(ctx, migration_step) kill_odoo(ctx, database, migration_step)

View File

@ -77,4 +77,4 @@ def run(
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
logger.info("Received Keyboard Interrupt or System Exiting...") logger.info("Received Keyboard Interrupt or System Exiting...")
finally: finally:
kill_odoo(ctx, migration_step) kill_odoo(ctx, database, migration_step)

View File

@ -43,5 +43,5 @@ def upgrade(ctx, first_step, last_step, database, with_demo):
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
logger.info("Received Keyboard Interrupt or System Exiting...") logger.info("Received Keyboard Interrupt or System Exiting...")
finally: finally:
kill_odoo(ctx, migration_step) kill_odoo(ctx, database, migration_step)
execute_click_odoo_python_files(ctx, database, migration_step) execute_click_odoo_python_files(ctx, database, migration_step)

View File

@ -107,13 +107,15 @@ def get_docker_image_tag(ctx, odoo_version: float) -> str:
) )
def get_docker_container_name(ctx, migration_step: dict) -> str: def get_docker_container_name(ctx, database: str, migration_step: dict) -> str:
"""Return a docker container name, based on project name, """Return a docker container name, based on project name, database name,
odoo version and migration step""" odoo version and migration step"""
return "odoo-openupgrade-wizard-container__%s__%s__step-%s" % ( return "oow-{project}-{database}-{version}-step-{step}".format(
ctx.obj["config"]["project_name"], project=ctx.obj["config"]["project_name"],
str(migration_step["version"]).rjust(4, "0"), database=database,
str(migration_step["name"]).rjust(2, "0"), # FIXME: version should be a string, but it is a float
version=str(migration_step["version"]).rjust(4, "0"),
step=str(migration_step["name"]).rjust(2, "0"),
) )
@ -280,7 +282,7 @@ def run_container_odoo(
return run_container( return run_container(
get_docker_image_tag(ctx, migration_step["version"]), get_docker_image_tag(ctx, migration_step["version"]),
get_docker_container_name(ctx, migration_step), get_docker_container_name(ctx, database, migration_step),
command=command, command=command,
ports={ ports={
host_xmlrpc_port: 8069, host_xmlrpc_port: 8069,
@ -295,8 +297,8 @@ def run_container_odoo(
) )
def kill_odoo(ctx, migration_step: dict): def kill_odoo(ctx, database, migration_step: dict):
kill_container(get_docker_container_name(ctx, migration_step)) kill_container(get_docker_container_name(ctx, database, migration_step))
def execute_click_odoo_python_files( def execute_click_odoo_python_files(
@ -351,7 +353,7 @@ def execute_click_odoo_python_files(
) )
raise e raise e
finally: finally:
kill_odoo(ctx, migration_step) kill_odoo(ctx, database, migration_step)
def get_odoo_modules_from_csv(module_file_path: Path) -> list: def get_odoo_modules_from_csv(module_file_path: Path) -> list: