mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add try/except to catch ipv6 interfaces that didn't appear on 'show interfaces' output (#27246)
This commit is contained in:
parent
4fad156768
commit
2571fc061e
1 changed files with 5 additions and 1 deletions
|
@ -315,6 +315,10 @@ 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):
|
||||||
|
try:
|
||||||
|
self.facts['interfaces'][key]['ipv6'] = list()
|
||||||
|
except KeyError:
|
||||||
|
self.facts['interfaces'][key] = dict()
|
||||||
self.facts['interfaces'][key]['ipv6'] = list()
|
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)
|
||||||
|
|
Loading…
Reference in a new issue