diff --git a/bench/config/production_setup.py b/bench/config/production_setup.py index 17e3174b..cc7d9c61 100755 --- a/bench/config/production_setup.py +++ b/bench/config/production_setup.py @@ -1,4 +1,4 @@ -from bench.utils import get_program, exec_cmd, get_cmd_output, fix_prod_setup_perms, get_bench_name, find_executable +from bench.utils import get_program, exec_cmd, get_cmd_output, fix_prod_setup_perms, get_bench_name, find_executable, CommandFailedError from bench.config.supervisor import generate_supervisor_config from bench.config.nginx import make_nginx_conf import os, subprocess @@ -95,9 +95,12 @@ def is_running_systemd(): return False def reload_supervisor(): - exec_cmd('sudo supervisorctl reload') - # exec_cmd('sudo supervisorctl reread') - # exec_cmd('sudo supervisorctl update') + try: + exec_cmd('sudo supervisorctl reread') + exec_cmd('sudo supervisorctl update') + + except CommandFailedError: + exec_cmd('sudo supervisorctl reload') def reload_nginx(): subprocess.check_output(['sudo', find_executable('nginx'), '-t']) diff --git a/bench/tests/test_setup_production.py b/bench/tests/test_setup_production.py index 7320b254..bc4f57bd 100644 --- a/bench/tests/test_setup_production.py +++ b/bench/tests/test_setup_production.py @@ -32,6 +32,10 @@ class TestSetupProduction(test_init.TestBenchInit): bench.utils.setup_sudoers(user) self.assert_sudoers(user) + for bench_name in ("test-bench-1", "test-bench-2"): + bench_path = os.path.join(os.path.abspath(self.benches_path), bench_name) + disable_production(bench_path) + def test_setup_production_v6(self): bench_name = 'test-bench-v6' self.test_init(bench_name, frappe_branch='master') @@ -47,6 +51,8 @@ class TestSetupProduction(test_init.TestBenchInit): self.assert_supervisor_config(bench_name, use_rq=False) self.assert_supervisor_process(bench_name, use_rq=False) + disable_production(bench_path) + def test_disable_production(self): bench_name = 'test-disable-prod' self.test_init(bench_name, frappe_branch='master')