From 97ef0fdded7c124b6f9e84803d8a08a190c1425f Mon Sep 17 00:00:00 2001 From: Steven Black Date: Thu, 24 Mar 2016 18:07:17 -0400 Subject: [PATCH] =?UTF-8?q?Issue=20#117=20=E2=80=94=20fix:=20restart=20net?= =?UTF-8?q?work.service=20if=20applicable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- updateHostsFile.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/updateHostsFile.py b/updateHostsFile.py index d391b970d..dfd4703ff 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -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':