Skip to content

Commit

Permalink
fix: install supervisor on user if doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Mar 15, 2020
1 parent f6292bb commit 395b8df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bench/patches/v5/fix_user_permissions.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# imports - standard imports
import subprocess
import sys

# imports - module imports
from bench.utils import log, get_cmd_output, exec_cmd
from bench.utils import log, get_cmd_output, exec_cmd, which
from bench.cli import change_uid_msg


def execute(bench_path):
"""fix supervisor using root then remove bench sudo later
chronology samajhiye"""
cmd = ["sudo", "-n", "bench"]

is_bench_sudoers_set = (not subprocess.call(cmd)) or (change_uid_msg in get_cmd_output(cmd))
is_supervisor_installed = which('supervisorctl')

if not is_supervisor_installed:
exec_cmd("{} -m pip install supervisor".format(sys.executable))

if is_bench_sudoers_set:
exec_cmd("sudo bench setup supervisor --yes")
Expand Down

0 comments on commit 395b8df

Please sign in to comment.