Skip to content
Snippets Groups Projects

Improve chown

Merged Vincent Hatakeyama requested to merge topic/default/improve-chown into branch/default
1 file
+ 12
2
Compare changes
  • Side-by-side
  • Inline
@@ -229,10 +229,11 @@ USAGE
"--no-dev", help="No dev options", action="store_false", dest="dev"
)
dev_option_group.add_argument(
"--ipdb",
help="Use ipdb rather than pdb",
action="store_true",
dest="ipdb",
"--dev-opt",
help="add extra dev options",
nargs="+",
dest="dev_opts",
default=[],
)
parser.add_argument(
"--load-language",
@@ -320,7 +321,7 @@ USAGE
run_isort = nmspc.isort
odoo_help = nmspc.odoo_help
dev = nmspc.dev
ipdb = nmspc.ipdb
dev_opts = nmspc.dev_opts
restore_filename = nmspc.DUMP
database = nmspc.database
load_language = ""
@@ -564,10 +565,15 @@ USAGE
# make sure the permission in the volumes are correct
if run_chown:
_logger.info("chown container’s /mnt to Odoo user")
chown_directories = ["/mnt"]
if odoo_type not in ("odoo7", "odoo8"):
chown_directories.append("/var/lib/odoo")
_logger.info(
"chown container’s %s to Odoo user", ", ".join(chown_directories)
)
client.containers.run(
image,
command=["odoo", "--recursive", "/mnt"],
command=["odoo", "--recursive"] + chown_directories,
remove=True,
entrypoint="/bin/chown",
mounts=mounts,
@@ -789,15 +795,25 @@ USAGE
if run_isort:
isort()
# developer mode options
if dev:
if odoo_type in ("odoo10", "odoo11", "odoo13"):
# pdb should not be run if not interactive
if ipdb:
arg.append("--dev=reload,ipdb")
else:
arg.append("--dev=reload,pdb")
# automatically add reload if not already asks for
if not any(opt not in dev_opts for opt in ("all", "reload")):
dev_opts.append("reload")
# XXX pdb should not be run if not interactive
# add pdb if no pubd, wdb, ipdb, pdb or all
# the list of available options differs by odoo version and can be
# seen with odoo --help, available with --odoo-help
if not any(
debugger not in dev_opts
for debugger in ("pubd", "wdb", "ipdb", "pdb", "all")
):
dev_opts.append("pdb")
arg.append(f"--dev={','.join(set(dev_opts))}")
if odoo_type in ("odoo8",):
arg.append("--auto-reload")
if odoo_help:
arg.append("--help")
Loading