diff --git a/bench/config/supervisor.py b/bench/config/supervisor.py index eadd0a7f..8b043daf 100644 --- a/bench/config/supervisor.py +++ b/bench/config/supervisor.py @@ -69,10 +69,13 @@ def update_supervisord_conf(user): supervisord_conf = get_supervisord_conf() section = "unix_http_server" + if not supervisord_conf: + return + config = configparser.ConfigParser() config.read(supervisord_conf) config[section]["chmod"] = "0760" - config[section]["chown"] = user + config[section]["chown"] = "{user}:{user}".format(user=user) with open(supervisord_conf, "w") as f: config.write(f) diff --git a/bench/patches/v5/fix_user_permissions.py b/bench/patches/v5/fix_user_permissions.py index 9da2ee99..41322472 100644 --- a/bench/patches/v5/fix_user_permissions.py +++ b/bench/patches/v5/fix_user_permissions.py @@ -1,4 +1,5 @@ # imports - standard imports +import getpass import os import subprocess @@ -33,6 +34,10 @@ def is_production_set(bench_path): def execute(bench_path): - if is_sudoers_set() or is_production_set(bench_path): - exec_cmd("sudo bench setup supervisor --yes") - exec_cmd("sudo bench setup sudoers") + user = getpass.getuser() + + if is_sudoers_set(): + exec_cmd("sudo bench setup sudoers {user}".format(user=user)) + + if is_production_set(bench_path): + exec_cmd("sudo bench setup supervisor --yes --user {user}".format(user=user))