Commit 4c9be266 authored by Laurent Peuch's avatar Laurent Peuch

[fix] meh, maybe subprocess will fix this...

parent 98fefaf2
......@@ -2,6 +2,7 @@ import os
import sys
import time
import shutil
import subprocess
from renew import renew
from debug_context_manager import debug
......@@ -50,14 +51,13 @@ def from_cube():
assert os.system(command) == 0, "ERROR: command failed"
time.sleep(5)
# command = "systemctl restart ynh-vpnclient"
# print("Critical part: reloading vpn using '%s'" % command)
# time.sleep(5)
# if os.system(command) != 0:
# time.sleep(5)
# print("ERROR: command failed, displaying logs")
# os.system("tail -n 200 /var/log/openvpn-client.log")
# sys.exit(1)
print("Critical part: reloading vpn using '%s'" % command)
try:
subprocess.check_output("systemctl restart ynh-vpnclient".split())
except Exception:
print("ERROR: command failed, displaying logs")
os.system("tail -n 200 /var/log/openvpn-client.log")
sys.exit(1)
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment