[Kimchi-devel] [PATCH V3 4/4] Various missing plumbing for nginx proxy disabling.
Julien Goodwin
jgoodwin at studio442.com.au
Tue Mar 17 09:37:42 UTC 2015
- terminate_proxy is called without options (and must be currently), so
set a global flag for it
- Add the missing passthrough of the option to the command line parser
- And the options as provided in the test util
Signed-off-by: Julien Goodwin <jgoodwin at studio442.com.au>
---
src/kimchi/proxy.py | 7 ++++++-
src/kimchid.in | 1 +
tests/utils.py | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/proxy.py b/src/kimchi/proxy.py
index 72497fe..050365e 100644
--- a/src/kimchi/proxy.py
+++ b/src/kimchi/proxy.py
@@ -88,9 +88,13 @@ def _create_proxy_config(options):
def start_proxy(options):
"""Start nginx reverse proxy."""
+ global run_proxy
if options.run_proxy == 'off':
+ run_proxy = False
return
+ run_proxy = True
+
_create_proxy_config(options)
config_dir = paths.conf_dir
config_file = "%s/nginx_kimchi.conf" % config_dir
@@ -100,7 +104,8 @@ def start_proxy(options):
def terminate_proxy():
"""Stop nginx process."""
- if options.run_proxy == 'off':
+ global run_proxy
+ if not run_proxy:
return
term_proxy_cmd = ['nginx', '-s', 'stop']
diff --git a/src/kimchid.in b/src/kimchid.in
index 57dc3c8..f6b66cc 100644
--- a/src/kimchid.in
+++ b/src/kimchid.in
@@ -85,6 +85,7 @@ def main(options):
config.config.set(sec, item, str(getattr(options, item)))
# Add non-option arguments
+ setattr(options, 'run_proxy', config.config.get('server', 'run_proxy'))
setattr(options, 'ssl_cert', config.config.get('server', 'ssl_cert'))
setattr(options, 'ssl_key', config.config.get('server', 'ssl_key'))
setattr(options, 'max_body_size',
diff --git a/tests/utils.py b/tests/utils.py
index 412487b..5428371 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -110,7 +110,7 @@ def run_server(host, port, ssl_port, test_mode, cherrypy_port=None,
args = type('_', (object,),
{'host': host, 'port': port, 'ssl_port': ssl_port,
'cherrypy_port': cherrypy_port, 'max_body_size': '4*1024',
- 'ssl_cert': '', 'ssl_key': '',
+ 'ssl_cert': '', 'ssl_key': '', 'run_proxy': 'on',
'test': test_mode, 'access_log': '/dev/null',
'error_log': '/dev/null', 'environment': environment,
'log_level': 'debug'})()
--
2.1.4
More information about the Kimchi-devel
mailing list