Commit a9b505b2 authored by Morten Brekkevold's avatar Morten Brekkevold

just make a single log entry for all devices with missing DNS

parent c0e8ffa7
......@@ -195,6 +195,9 @@ def lookup_addresses(kind_devices):
for name in kind_device.get_alternate_names()}
lookups = lookup_dns(list(names.keys()))
LOG.debug("lookups: %r", lookups)
with_missing_dns = []
for kind_device in sorted(kind_devices.values(), key=attrgetter('name')):
for name in kind_device.get_alternate_names():
addrs = lookups.get(name, [])
......@@ -203,7 +206,7 @@ def lookup_addresses(kind_devices):
break
if not addrs:
LOG.error('%s mangler DNS-innslag', kind_device)
with_missing_dns.append(kind_device)
kind_device.ignore_insert = True
elif len(addrs) > 1:
LOG.error("%s har flere DNS-innslag, kan ikke velge: %s",
......@@ -212,6 +215,10 @@ def lookup_addresses(kind_devices):
else:
kind_device.loopback = addrs[0]
if with_missing_dns:
LOG.error("Ignorerer utstyr som mangler DNS-innslag:\n%s",
with_missing_dns)
def lookup_dns(names):
result = defaultdict(list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment