[Kimchi-devel] [PATCH] [Wok 2/2] Make sure nginx is running before reloading its config

Lucio Correia luciojhc at linux.vnet.ibm.com
Tue Jan 24 19:36:56 UTC 2017


Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 src/wok/proxy.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/wok/proxy.py b/src/wok/proxy.py
index 7376f09..099224c 100644
--- a/src/wok/proxy.py
+++ b/src/wok/proxy.py
@@ -28,6 +28,7 @@ import os
 
 from wok import sslcert
 from wok.config import paths
+from wok.utils import run_command
 
 
 DH_COMMAND = "openssl dhparam -dsaparam -out %s 2048"
@@ -75,4 +76,10 @@ def check_proxy_config():
             f.write(ssl_gen.key_pem())
 
     # Reload nginx configuration.
+    cmd = ['service', 'nginx', 'status']
+    output, error, rc = run_command(cmd)
+    if rc != 0:
+        cmd = ['service', 'nginx', 'restart']
+        output, error, rc = run_command(cmd)
+
     os.system('nginx -s reload')
-- 
2.7.4



More information about the Kimchi-devel mailing list