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
dba73e30
Commit
dba73e30
authored
Aug 21, 2018
by
Morten Brekkevold
Browse files
Silently ignore Kind records that appear to be automatically generated or otherwise in error
parent
1f31677b
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/kindnavsync
View file @
dba73e30
...
...
@@ -180,7 +180,8 @@ def find_duplicates(names):
def
clean_data
(
kind_data
):
kind_devices
=
[
KindDevice
.
from_json_record
(
record
)
for
record
in
kind_data
]
kind_devices
=
[
KindDevice
.
from_json_record
(
record
)
for
record
in
kind_data
if
not
should_silently_ignore
(
record
)]
invalid_names
=
{
device
for
device
in
kind_devices
if
not
device_name_is_okay
(
device
.
name
)}
...
...
@@ -210,6 +211,18 @@ def device_name_is_okay(name):
return
'.'
in
name
and
' '
not
in
name
def
should_silently_ignore
(
kind_json_record
):
"""
Silently ignore Kind records that appear to be automatically generated
or otherwise in error
"""
result
=
'fru.pl'
in
kind_json_record
.
get
(
'opprettet_av'
,
''
)
if
result
:
LOG
.
debug
(
"Ignorerer stille %s (%s)"
,
kind_json_record
.
get
(
'navn'
),
kind_json_record
.
get
(
'id'
))
return
result
def
lookup_addresses
(
kind_devices
):
"""Runs DNS lookups for all collected Kind devices"""
names
=
{
name
:
kind_device
...
...
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