From 2571fc061e583a6ae959c4ad31d3d6a7b49ffd72 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 7 Aug 2017 13:04:50 -0400 Subject: [PATCH] Add try/except to catch ipv6 interfaces that didn't appear on 'show interfaces' output (#27246) --- lib/ansible/modules/network/ios/ios_facts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/ios/ios_facts.py b/lib/ansible/modules/network/ios/ios_facts.py index 4b3738215e0..cc07ca6e75d 100644 --- a/lib/ansible/modules/network/ios/ios_facts.py +++ b/lib/ansible/modules/network/ios/ios_facts.py @@ -315,7 +315,11 @@ class Interfaces(FactsBase): def populate_ipv6_interfaces(self, 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) subnets = re.findall(r', subnet is (.+)$', value, re.M) for addr, subnet in zip(addresses, subnets):