From d4b0e0f70d6a5477dfd2fa594a43a69f28b4d842 Mon Sep 17 00:00:00 2001 From: shreyas Date: Mon, 22 Feb 2016 14:43:33 +0530 Subject: [PATCH 1/2] [Fix] Fixed symlink creation for supervisor.conf and nginx.conf for already existing conf files --- bench/production_setup.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bench/production_setup.py b/bench/production_setup.py index ae2a4e9d..acfe818f 100644 --- a/bench/production_setup.py +++ b/bench/production_setup.py @@ -61,8 +61,15 @@ def setup_production(user, bench='.'): else: supervisor_conf_filename = 'frappe.conf' - os.symlink(os.path.abspath(os.path.join(bench, 'config', 'supervisor.conf')), os.path.join(get_supervisor_confdir(), supervisor_conf_filename)) - os.symlink(os.path.abspath(os.path.join(bench, 'config', 'nginx.conf')), '/etc/nginx/conf.d/frappe.conf') + supervisor_conf_path = os.path.join(get_supervisor_confdir(), supervisor_conf_filename) + nginx_conf_path = '/etc/nginx/conf.d/frappe.conf' + + if not os.path.exists(supervisor_conf_path): + os.symlink(os.path.abspath(os.path.join(bench, 'config', 'supervisor.conf')), supervisor_conf_path) + + if not os.path.exists(nginx_conf_path): + os.symlink(os.path.abspath(os.path.join(bench, 'config', 'nginx.conf')), nginx_conf_path) + exec_cmd('supervisorctl reload') if os.environ.get('NO_SERVICE_RESTART'): return From 76efe0ce79a650ee5184cec6c7113314f362759c Mon Sep 17 00:00:00 2001 From: shreyas Date: Mon, 22 Feb 2016 14:49:43 +0530 Subject: [PATCH 2/2] [Fix] Corrected the fix to disallow symlink creation for supervisor and nginx config files if they already exist --- bench/production_setup.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bench/production_setup.py b/bench/production_setup.py index acfe818f..b1130ddf 100644 --- a/bench/production_setup.py +++ b/bench/production_setup.py @@ -62,14 +62,17 @@ def setup_production(user, bench='.'): supervisor_conf_filename = 'frappe.conf' supervisor_conf_path = os.path.join(get_supervisor_confdir(), supervisor_conf_filename) + supervisor_sym_link_path = os.path.abspath(os.path.join(bench, 'config', 'supervisor.conf')) + nginx_conf_path = '/etc/nginx/conf.d/frappe.conf' + nginx_sym_link_path = os.path.abspath(os.path.join(bench, 'config', 'nginx.conf')) - if not os.path.exists(supervisor_conf_path): - os.symlink(os.path.abspath(os.path.join(bench, 'config', 'supervisor.conf')), supervisor_conf_path) + if not os.path.exists(supervisor_sym_link_path): + os.symlink(supervisor_sym_link_path, supervisor_conf_path) + + if not os.path.exists(nginx_sym_link_path): + os.symlink(supervisor_sym_link_path, nginx_conf_path) - if not os.path.exists(nginx_conf_path): - os.symlink(os.path.abspath(os.path.join(bench, 'config', 'nginx.conf')), nginx_conf_path) - exec_cmd('supervisorctl reload') if os.environ.get('NO_SERVICE_RESTART'): return