libs/tools: change resolve_identifier() to return ipv4 and ipv6 separately
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
67386d9efa
commit
eaf268aea9
3 changed files with 28 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
|||
from bundlewrap.exceptions import NoSuchGroup, NoSuchNode
|
||||
from ipaddress import ip_address
|
||||
from ipaddress import ip_address, IPv4Address
|
||||
|
||||
def resolve_identifier(repo, identifier):
|
||||
"""
|
||||
|
@ -29,4 +29,15 @@ def resolve_identifier(repo, identifier):
|
|||
if node.metadata.get('external_ipv4', None):
|
||||
found_ips.add(ip_address(node.metadata.get('external_ipv4')))
|
||||
|
||||
return found_ips
|
||||
ip_dict = {
|
||||
'ipv4': set(),
|
||||
'ipv6': set(),
|
||||
}
|
||||
|
||||
for ip in found_ips:
|
||||
if isinstance(ip, IPv4Address):
|
||||
ip_dict['ipv4'].add(ip)
|
||||
else:
|
||||
ip_dict['ipv6'].add(ip)
|
||||
|
||||
return ip_dict
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue