mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +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
|
# imports - standard imports
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
# imports - module imports
|
# 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
|
from bench.cli import change_uid_msg
|
||||||
|
|
||||||
|
|
||||||
def execute(bench_path):
|
def execute(bench_path):
|
||||||
"""fix supervisor using root then remove bench sudo later
|
|
||||||
chronology samajhiye"""
|
|
||||||
cmd = ["sudo", "-n", "bench"]
|
cmd = ["sudo", "-n", "bench"]
|
||||||
|
|
||||||
is_bench_sudoers_set = (not subprocess.call(cmd)) or (change_uid_msg in get_cmd_output(cmd))
|
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:
|
if is_bench_sudoers_set:
|
||||||
exec_cmd("sudo bench setup supervisor --yes")
|
exec_cmd("sudo bench setup supervisor --yes")
|
||||||
|
Loading…
Reference in New Issue
Block a user