From 8b02bed71cd60d64d3fad1ea40e31884afbee552 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Fri, 30 Nov 2018 13:47:06 +0530 Subject: [PATCH] fix: setup nginx fails for broken site_config Signed-off-by: Ameya Shenoy --- bench/config/nginx.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bench/config/nginx.py b/bench/config/nginx.py index 6dc3a121..4d60529d 100644 --- a/bench/config/nginx.py +++ b/bench/config/nginx.py @@ -187,7 +187,23 @@ def get_sites_with_config(bench_path): ret = [] for site in sites: - site_config = get_site_config(site, bench_path=bench_path) + try: + site_config = get_site_config(site, bench_path=bench_path) + except Exception as e: + strict_nginx = get_config(bench_path).get('strict_nginx') + if strict_nginx: + print("\n\nERROR: The site config for the site {} is broken.".format(site), + "If you want this command to pass, instead of just throwing an error,", + "You may remove the 'strict_nginx' flag from common_site_config.json or set it to 0", + "\n\n") + raise (e) + else: + print("\n\nWARNING: The site config for the site {} is broken.".format(site), + "If you want this command to fail, instead of just showing a warning,", + "You may add the 'strict_nginx' flag to common_site_config.json and set it to 1", + "\n\n") + continue + ret.append({ "name": site, "port": site_config.get('nginx_port'),