mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
fix: install supervisor on user if doesnt exist
This commit is contained in:
parent
f6292bba77
commit
395b8df895
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user