Skip to content
Snippets Groups Projects
Commit 38be1342 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

fix case when nmcli is present but does not handle dns

parent 802a30cb
No related branches found
No related tags found
No related merge requests found
......@@ -17,13 +17,16 @@ from envsetup import utils as u # noqa: E402
def get_dns_servers() -> set:
servers = list()
if subprocess.getstatusoutput("command -v nmcli")[0] == 0:
# network-manager
_, output = subprocess.getstatusoutput(
"nmcli -f all device show | grep IP4.DNS | awk '{ print $2 }'"
)
servers = output.split("\n")
else:
if not len(servers):
# resolvconf
with open("/etc/resolv.conf", "r") as f:
d = f.read().strip()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment