[Dnssec-trigger] [PATCH 1/3] dnssec-trigger-script: Use ducktaping when restarting NM, instead of checking the sysfs

Tomas Hozza thozza at redhat.com
Thu May 19 14:48:52 UTC 2016


This did not work with SELinux policy on Fedora

Signed-off-by: Tomas Hozza <thozza at redhat.com>
---
 dnssec-trigger-script.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dnssec-trigger-script.in b/dnssec-trigger-script.in
index cf7df97..e9134dd 100644
--- a/dnssec-trigger-script.in
+++ b/dnssec-trigger-script.in
@@ -540,10 +540,11 @@ class Application:
             nm_pids = pidof('NetworkManager')
             for pid in nm_pids:
                 os.kill(pid, signal.SIGHUP)
-        elif os.path.exists("/sys/fs/cgroup/systemd"):
-            subprocess.check_call(["systemctl", "--ignore-dependencies", "try-restart", "NetworkManager.service"])
         else:
-            subprocess.check_call(["/etc/init.d/NetworkManager", "restart"])
+            try:
+                subprocess.check_call(["systemctl", "--ignore-dependencies", "try-restart", "NetworkManager.service"], stdout=DEVNULL, stderr=DEVNULL)
+            except subprocess.CalledProcessError:
+                subprocess.check_call(["/etc/init.d/NetworkManager", "restart"], stdout=DEVNULL, stderr=DEVNULL)
 
     def run_prepare(self):
         """Prepare for starting dnssec-trigger
-- 
2.5.5




More information about the dnssec-trigger mailing list