Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
77ed1970e1 | ||
![]() |
5a1ca9142d |
2 changed files with 14 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
from ipaddress import ip_interface
|
||||
hdict, hlist = repo.libs.hashable.hdict, repo.libs.hashable.hlist
|
||||
|
||||
|
||||
defaults = {
|
||||
|
@ -75,9 +76,9 @@ def collect_records(metadata):
|
|||
for type, values in records.items():
|
||||
for value in values:
|
||||
zones\
|
||||
.setdefault(zone, [])\
|
||||
.append(
|
||||
{'name': name, 'type': type, 'value': value}
|
||||
.setdefault(zone, set())\
|
||||
.add(
|
||||
hdict({'name': name, 'type': type, 'value': value})
|
||||
)
|
||||
|
||||
return {
|
||||
|
@ -104,10 +105,10 @@ def ns_records(metadata):
|
|||
return {
|
||||
'bind': {
|
||||
'zones': {
|
||||
zone: [
|
||||
{'name': '@', 'type': 'NS', 'value': f"{nameserver}."}
|
||||
zone: {
|
||||
hdict({'name': '@', 'type': 'NS', 'value': f"{nameserver}."})
|
||||
for nameserver in nameservers
|
||||
] for zone in metadata.get('bind/zones').keys()
|
||||
} for zone in metadata.get('bind/zones').keys()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
7
libs/hashable.py
Normal file
7
libs/hashable.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
class hdict(dict):
|
||||
def __hash__(self):
|
||||
return hash(tuple(sorted(self.items())))
|
||||
|
||||
class hlist(list):
|
||||
def __hash__(self):
|
||||
return hash(tuple(sorted(self)))
|
Loading…
Reference in a new issue