Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
verktoy
kindnavsync
Commits
a9b505b2
Commit
a9b505b2
authored
Jun 26, 2018
by
Morten Brekkevold
Browse files
just make a single log entry for all devices with missing DNS
parent
c0e8ffa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/kindnavsync
View file @
a9b505b2
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment