libs/tools: adjust resolve_identifier() to new interface config

This commit is contained in:
Franzi 2020-11-09 15:23:44 +01:00
parent d90c9edc22
commit 44414f2375
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -20,10 +20,11 @@ def resolve_identifier(repo, identifier):
found_ips = set() found_ips = set()
for node in nodes: for node in nodes:
for interface, config in node.metadata.get('interfaces', {}).items(): for interface, config in node.metadata.get('interfaces', {}).items():
for ip in config.get('ipv4', set()): for ip in config.get('ips', set()):
found_ips.add(ip_address(ip)) if '/' in ip:
for ip in config.get('ipv4', set()): found_ips.add(ip_address(ip.split('/')[0]))
found_ips.add(ip_address(ip)) else:
found_ips.add(ip_address(ip))
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')))