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

(cherry picked from commit cd662efd2b)
pull/22995/head
Dhivyap 8 years ago committed by Peter Sprygada
parent 7f1a7a4372
commit 43310bb7b7

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

Loading…
Cancel
Save