[FIX] allow to run multiple post-*py by step

Like:
scripts/step_01__regular__12.0/01-post-migration-uninstall-modules.py
scripts/step_01__regular__12.0/02-post-migration-fix-project-issues.py
scripts/step_01__regular__12.0/03-post-migration-fix-mail-aliases.py
scripts/step_01__regular__12.0/04-fix-misc-inconsistant-records.py
This commit is contained in:
Simon Maillard 2024-08-21 10:12:14 +02:00
parent 5eed63ca56
commit 39f70d1012

View File

@ -325,9 +325,9 @@ def execute_click_odoo_python_files(
if os.path.isfile(os.path.join(script_folder, f)) if os.path.isfile(os.path.join(script_folder, f))
and f[-3:] == ".py" and f[-3:] == ".py"
] ]
python_files = sorted(python_files) python_files = sorted([str(x) for x in python_files])
command = generate_odoo_command( base_command = generate_odoo_command(
ctx, ctx,
migration_step, migration_step,
execution_context, execution_context,
@ -336,16 +336,13 @@ def execute_click_odoo_python_files(
) )
for python_file in python_files: for python_file in python_files:
command = ("/bin/bash -c 'cat /env/{python_file} | {command}'").format( command = f"/bin/bash -c 'cat /env/{python_file} | {base_command}'"
command=command,
python_file=str(python_file),
)
try: try:
logger.info( logger.info(
f"Step {migration_step['complete_name']}." f"Step {migration_step['complete_name']}."
f" Executing script {python_file} ..." f" Executing script {python_file} ..."
) )
return run_container_odoo( run_container_odoo(
ctx, ctx,
migration_step, migration_step,
command, command,