Skip to content

Commit 78c36d2

Browse files
author
3np
committed
fix(qubes-setup-dnat-to-ns): handle null dns debus response as error
python typings indicate that resolve1.Get may return None. Handle this possibility as failure, falling back to resolv.conf
1 parent e5d626b commit 78c36d2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

network/qubes-setup-dnat-to-ns

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def get_dns_resolv_conf():
4848
return nameservers
4949

5050
def get_dns_resolved():
51+
dns = []
5152
try:
5253
bus = dbus.SystemBus()
5354
except dbus.exceptions.DBusException as s:
@@ -60,6 +61,9 @@ def get_dns_resolved():
6061
dns = resolve1.Get('org.freedesktop.resolve1.Manager',
6162
'DNS',
6263
dbus_interface='org.freedesktop.DBus.Properties')
64+
if dns is Nothing:
65+
return get_dns_resolv_conf()
66+
6367
except dbus.exceptions.DBusException as s:
6468
error = s.get_dbus_name()
6569
if error in (

0 commit comments

Comments
 (0)