1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixes#21557-Handled dellos9_facts crash with IPV6 configs (#21652)

This commit is contained in:
Dhivyap 2017-03-24 08:36:26 +05:30 committed by Peter Sprygada
parent 1cfaa5caab
commit cd662efd2b

View file

@ -309,13 +309,14 @@ class Interfaces(FactsBase):
def populate_ipv6_interfaces(self, data):
for key, value in data.items():
self.facts['interfaces'][key]['ipv6'] = list()
addresses = re.findall(r'\s+(.+), subnet', value, re.M)
subnets = re.findall(r', subnet is (\S+)', value, re.M)
for addr, subnet in itertools.izip(addresses, subnets):
ipv6 = dict(address=addr.strip(), subnet=subnet.strip())
self.add_ip_address(addr.strip(), 'ipv6')
self.facts['interfaces'][key]['ipv6'].append(ipv6)
if key in self.facts['interfaces']:
self.facts['interfaces'][key]['ipv6'] = list()
addresses = re.findall(r'\s+(.+), subnet', value, re.M)
subnets = re.findall(r', subnet is (\S+)', value, re.M)
for addr, subnet in itertools.izip(addresses, subnets):
ipv6 = dict(address=addr.strip(), subnet=subnet.strip())
self.add_ip_address(addr.strip(), 'ipv6')
self.facts['interfaces'][key]['ipv6'].append(ipv6)
def add_ip_address(self, address, family):
if family == 'ipv4':