bundles/powerdns: also try to use node.hostname for dns generation
This commit is contained in:
parent
226fac0d78
commit
36a4ebcdd6
1 changed files with 13 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
from ipaddress import ip_address, IPv4Address
|
from ipaddress import ip_address, IPv4Address, IPv6Address
|
||||||
|
|
||||||
from bundlewrap.metadata import atomic
|
from bundlewrap.metadata import atomic
|
||||||
|
|
||||||
|
@ -159,6 +159,18 @@ 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))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue