2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-23 12:39:01 +00:00

[Fix] Command needs superuser previlege to run

This commit is contained in:
shreyas 2016-06-30 12:02:57 +05:30
parent 41f3f7e639
commit 85f8d1be30
2 changed files with 4 additions and 4 deletions

View File

@ -50,7 +50,7 @@ def cmd_requires_root():
if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt'):
return True
#Changed > to >=, unsure if will cause the apolcaypse
if len(sys.argv) >= 2 and sys.argv[1] in ('patch', 'renew-lets-encrypt'):
if len(sys.argv) >= 2 and sys.argv[1] in ('patch', 'renew-lets-encrypt', 'disable-production'):
return True
def change_dir():

View File

@ -23,7 +23,7 @@ def setup_production(user, bench_path='.'):
if not os.path.islink(nginx_conf):
os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')), nginx_conf)
exec_cmd('supervisorctl reload')
exec_cmd('sudo supervisorctl reload')
if os.environ.get('NO_SERVICE_RESTART'):
return
@ -53,9 +53,9 @@ def disable_production(bench_path='.'):
def service(service, option):
if os.path.basename(get_program(['systemctl']) or '') == 'systemctl' and is_running_systemd():
exec_cmd("{service_manager} {option} {service}".format(service_manager='systemctl', option=option, service=service))
exec_cmd("sudo {service_manager} {option} {service}".format(service_manager='systemctl', option=option, service=service))
elif os.path.basename(get_program(['service']) or '') == 'service':
exec_cmd("{service_manager} {service} {option} ".format(service_manager='service', service=service, option=option))
exec_cmd("sudo {service_manager} {service} {option} ".format(service_manager='service', service=service, option=option))
else:
# look for 'service_manager' and 'service_manager_command' in environment
service_manager = os.environ.get("BENCH_SERVICE_MANAGER")