move hostname stuff to libs.tools.resolve_identifier

This commit is contained in:
Franzi 2022-01-04 11:41:31 +01:00
parent 02f4547652
commit 906b63b123
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 5 additions and 12 deletions

View file

@ -159,18 +159,6 @@ def generate_dns_entries_for_nodes(metadata):
if not ip4 and isinstance(addr, IPv4Address): if not ip4 and isinstance(addr, IPv4Address):
ip4 = addr ip4 = addr
if not ip4:
try:
ip4 = IPv4Address(rnode.hostname)
except ValueError:
pass
if not ip6:
try:
ip6 = IPv6Address(rnode.hostname)
except ValueError:
pass
if ip4: if ip4:
results.add('{} IN A {}'.format(dns_name, ip4)) results.add('{} IN A {}'.format(dns_name, ip4))

View file

@ -42,6 +42,11 @@ def resolve_identifier(repo, identifier):
if node.metadata.get('external_ipv4', None): if node.metadata.get('external_ipv4', None):
found_ips.add(ip_address(node.metadata.get('external_ipv4'))) found_ips.add(ip_address(node.metadata.get('external_ipv4')))
try:
found_ips.add(ip_address(node.hostname))
except ValueError:
pass
ip_dict = { ip_dict = {
'ipv4': set(), 'ipv4': set(),
'ipv6': set(), 'ipv6': set(),