Skip to content

Commit

Permalink
fix: run patches for current user
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Mar 16, 2020
1 parent fe02844 commit 78dbdcb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bench/config/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions bench/patches/v5/fix_user_permissions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# imports - standard imports
import getpass
import os
import subprocess

Expand Down Expand Up @@ -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))

0 comments on commit 78dbdcb

Please sign in to comment.