Skip to content

Commit

Permalink
added support for either resolv.conf or resolvectl
Browse files Browse the repository at this point in the history
  • Loading branch information
lgandx committed Jan 6, 2024
1 parent e51f24e commit 1a2f2fd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1a2f2fd

Please sign in to comment.