From db3d16e37ceb92c6c5a3f6dfec1a9a9810ec3ef9 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 29 Jun 2022 10:34:58 +0200 Subject: [PATCH] [IMP] make cli_05_execute_script_python_test working --- .../templates/odoo/Dockerfile.j2 | 7 ++-- odoo_openupgrade_wizard/tools/tools_odoo.py | 34 +++++-------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 b/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 index 130559f..f9c3261 100644 --- a/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 +++ b/odoo_openupgrade_wizard/templates/odoo/Dockerfile.j2 @@ -1,6 +1,6 @@ FROM ghcr.io/acsone/odoo-bedrock:{{ odoo_version }}-{{python_minor_version_short}}-latest -COPY ./src/odoo/requirements.txt /odoo_requirements.txt +COPY ./src/odoo/ /odoo/src/odoo COPY debian_requirements.txt /debian_requirements.txt COPY python_requirements.txt /python_requirements.txt @@ -11,5 +11,6 @@ RUN apt-get update || true \ # 3. Install extra Python librairies RUN \ - /odoo/bin/pip install --no-cache-dir -r /odoo_requirements.txt -f {{prebuild_wheel_url}} \ - && /odoo/bin/pip install --no-cache-dir -r /python_requirements.txt -f {{prebuild_wheel_url}} + /odoo/bin/pip install --no-cache-dir -r /odoo/src/odoo/requirements.txt -f https://wheelhouse.acsone.eu/manylinux2014 \ + && /odoo/bin/pip install --no-cache-dir -r /python_requirements.txt -f https://wheelhouse.acsone.eu/manylinux2014 \ + && /odoo/bin/pip install -e /odoo/src/odoo diff --git a/odoo_openupgrade_wizard/tools/tools_odoo.py b/odoo_openupgrade_wizard/tools/tools_odoo.py index 5eae1b1..271169f 100644 --- a/odoo_openupgrade_wizard/tools/tools_odoo.py +++ b/odoo_openupgrade_wizard/tools/tools_odoo.py @@ -274,24 +274,11 @@ def execute_click_odoo_python_files( ] python_files = sorted(python_files) - # Prepare data information for docker - links = {ctx.obj["config"]["postgres_container_name"]: "db"} - env_path = ctx.obj["env_folder_path"] - odoo_env_path = get_odoo_env_path(ctx, migration_step["version"]) - - # Generate odoo config file - # log_file = "/env/log/{}____{}__post_migration.log".format( - # ctx.obj["log_prefix"], migration_step["complete_name"] - # ) - for python_file in python_files: # TODO, check if we should set python2 for old version of Odoo # or just 'python' command = ( - "click-odoo" - " --database {database}" - " --config /odoo_env/_auto_generated_odoo.cfg" - " /env/{python_file}" + "click-odoo" " --database {database}" " /env/{python_file}" ).format( database=database, python_file=str(python_file), @@ -301,19 +288,14 @@ def execute_click_odoo_python_files( "Executing script %s / %s" % (migration_step["complete_name"], python_file) ) - run_container( - get_docker_image_tag(ctx, migration_step["version"]), - get_docker_container_name(ctx, migration_step), - command=command, - ports={}, - volumes={ - env_path: "/env/", - odoo_env_path: "/odoo_env/", - }, - links=links, - detach=False, - auto_remove=True, + return run_container_odoo( + ctx, + migration_step, + command, + detached_container=False, + database=database, ) + except Exception as e: traceback.print_exc() logger.error(