From 1a2f2fdb22a2bf8b04e0ac99219831457b7ba43a Mon Sep 17 00:00:00 2001 From: lgandx Date: Sat, 6 Jan 2024 15:01:43 -0300 Subject: [PATCH] added support for either resolv.conf or resolvectl --- settings.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/settings.py b/settings.py index 87caa5e..6225de2 100644 --- a/settings.py +++ b/settings.py @@ -335,10 +335,12 @@ def populate(self, options): NetworkCard = "Error fetching Network Interfaces:", ex pass try: - DNS = subprocess.check_output(["resolvectl", "status"]) - except subprocess.CalledProcessError as ex: - DNS = "Error fetching DNS configuration:", ex - pass + p = subprocess.Popen('resolvectl', stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + DNS = p.stdout.read() + except: + p = subprocess.Popen(['cat', '/etc/resolv.conf'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + DNS = p.stdout.read() + try: RoutingInfo = subprocess.check_output(["netstat", "-rn"]) except: