Issue #117 — fix: restart network.service if applicable.
authorSteven Black <redacted>
Thu, 24 Mar 2016 22:07:17 +0000 (18:07 -0400)
committerSteven Black <redacted>
Thu, 24 Mar 2016 22:07:17 +0000 (18:07 -0400)
updateHostsFile.py

index d391b970d48c7d7350017e0a37fd156a15fa7574..dfd4703ffcc41c52fa568d479348e3ed43542649 100644 (file)
@@ -457,6 +457,12 @@ def moveHostsFileIntoPlace(finalFile):
                     printFailure("Flushing the DNS Cache failed.")
                 else:
                     printSuccess("Flushing DNS by restarting dnsmasq succeeded")
+            if os.path.isfile("/usr/lib/systemd/system/networking.service"):
+                dnsCacheFound = True
+                if subprocess.call(["/usr/bin/sudo", "/usr/bin/systemctl", "restart", "networking.service"]):
+                    printFailure("Flushing the DNS Cache failed.")
+                else:
+                    printSuccess("Flushing DNS by restarting networking.service succeeded")
             if not dnsCacheFound:
                 printFailure("Unable to determine DNS management tool.")
     elif os.name == 'nt':
git clone https://git.99rst.org/PROJECT