# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1606292544 -3600 # Wed Nov 25 09:22:24 2020 +0100 # Node ID 5c57c411de886979a910daedc8805dad5d24065e # Parent 9bdab72a5b2d0fabde74c2b952aae4992fb5a592 🔨 docker_dev_start stop doing chown systematically diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -9,6 +9,8 @@ docker_dev_start and do_tests: use socket when starting postgresql rather than a port that might be used on the host. +docker_dev_start stops doing systematic chown on the content of /mnt in the container. The argument ``--chown`` can be used to do that. This was needed when the odoo user changed in an image, a rare occurence. + Add :ref:`docker_pg.py` command to start postgres like :ref:`docker_dev_start.py` does when using ``--start-postgresql``, but without starting odoo. 4.2.1 diff --git a/odoo_scripts/docker_dev_start.py b/odoo_scripts/docker_dev_start.py --- a/odoo_scripts/docker_dev_start.py +++ b/odoo_scripts/docker_dev_start.py @@ -278,6 +278,13 @@ dest="PRE_SQL", ) + parser.add_argument( + "--chown", + help="run chown [default: %(default)s]", + action="store_true", + dest="run_chown", + ) + # TODO detect that user is member of docker group # TODO add a way to add options to docker @@ -302,6 +309,7 @@ installing_or_updating = False odoo_sources = nmspc.odoo_sources pre_sql_script = nmspc.PRE_SQL + run_chown = nmspc.run_chown if restore_filename: if not database: @@ -537,15 +545,15 @@ arg.append(data_volume_path) # make sure the permission in the volumes are correct - # TODO replace by something cleaner if possible - _logger.info("chown") - client.containers.run( - image, - command=["odoo", "--recursive", "/mnt"], - remove=True, - entrypoint="/bin/chown", - mounts=mounts, - ) + if run_chown: + _logger.info("chown /mnt to container Odoo user") + client.containers.run( + image, + command=["odoo", "--recursive", "/mnt"], + remove=True, + entrypoint="/bin/chown", + mounts=mounts, + ) # avoid the duplication of unbind volumes with all addons if odoo_type == "odoo7":