Add try/except to catch ipv6 interfaces that didn't appear on 'show interfaces' output (#27246)

This commit is contained in:
Tyler 2017-08-07 13:04:50 -04:00 committed by Ricardo Carrillo Cruz
parent 4fad156768
commit 2571fc061e

View file

@ -315,7 +315,11 @@ class Interfaces(FactsBase):
def populate_ipv6_interfaces(self, data): def populate_ipv6_interfaces(self, data):
for key, value in iteritems(data): for key, value in iteritems(data):
self.facts['interfaces'][key]['ipv6'] = list() try:
self.facts['interfaces'][key]['ipv6'] = list()
except KeyError:
self.facts['interfaces'][key] = dict()
self.facts['interfaces'][key]['ipv6'] = list()
addresses = re.findall(r'\s+(.+), subnet', value, re.M) addresses = re.findall(r'\s+(.+), subnet', value, re.M)
subnets = re.findall(r', subnet is (.+)$', value, re.M) subnets = re.findall(r', subnet is (.+)$', value, re.M)
for addr, subnet in zip(addresses, subnets): for addr, subnet in zip(addresses, subnets):