This commit is contained in:
mwiegand 2021-07-12 23:25:59 +02:00
parent bb6146a6db
commit be6a33585e
3 changed files with 26 additions and 19 deletions

View file

@ -137,6 +137,13 @@ for view in views:
} }
for zone, records in zones.items(): for zone, records in zones.items():
unique_records = [
dict(record_tuple)
for record_tuple in set(
tuple(record.items()) for record in records
)
]
files[f"/var/lib/bind/{view['name']}/db.{zone}"] = { files[f"/var/lib/bind/{view['name']}/db.{zone}"] = {
'group': 'bind', 'group': 'bind',
'source': 'db', 'source': 'db',
@ -146,7 +153,7 @@ for view in views:
'serial': datetime.now().strftime('%Y%m%d%H'), 'serial': datetime.now().strftime('%Y%m%d%H'),
'records': list(filter( 'records': list(filter(
lambda record: use_record(record, records, view['name']), lambda record: use_record(record, records, view['name']),
records unique_records
)), )),
'hostname': node.metadata.get('bind/hostname'), 'hostname': node.metadata.get('bind/hostname'),
}, },

View file

@ -96,15 +96,15 @@ def datasource_key_to_name(metadata):
} }
# @metadata_reactor.provides( @metadata_reactor.provides(
# 'dns', 'dns',
# ) )
# def dns(metadata): def dns(metadata):
# return { return {
# 'dns': { 'dns': {
# metadata.get('grafana/hostname'): repo.libs.dns.get_a_records(metadata), metadata.get('grafana/hostname'): repo.libs.dns.get_a_records(metadata),
# } }
# } }
@metadata_reactor.provides( @metadata_reactor.provides(

View file

@ -44,15 +44,15 @@ def admin_password(metadata):
} }
# @metadata_reactor.provides( @metadata_reactor.provides(
# 'dns', 'dns',
# ) )
# def dns(metadata): def dns(metadata):
# return { return {
# 'dns': { 'dns': {
# metadata.get('influxdb/hostname'): repo.libs.dns.get_a_records(metadata), metadata.get('influxdb/hostname'): repo.libs.dns.get_a_records(metadata),
# } }
# } }
@metadata_reactor.provides( @metadata_reactor.provides(