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

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Jan 25 20:46:55 UTC 2017


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

diff --git a/src/wok/proxy.py b/src/wok/proxy.py
index c26925d..2d4653e 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,9 @@ def check_proxy_config():
             f.write(ssl_gen.key_pem())
 
     # Reload nginx configuration.
-    os.system('nginx -s reload')
+    cmd = ['service', 'nginx', 'status']
+    output, error, rc = run_command(cmd)
+    if rc != 0:
+        os.system('service nginx start')
+    else:
+        os.system('nginx -s reload')
-- 
2.7.4



More information about the Kimchi-devel mailing list