mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
routeros_facts: fix crash when ipv6 is disabled (#39)
* routeros_facts: fix crash when ipv6 is disabled * chore: rename fixture file
This commit is contained in:
parent
5c372e0a7c
commit
4fba692c1b
3 changed files with 13 additions and 0 deletions
|
@ -289,6 +289,8 @@ class Interfaces(FactsBase):
|
|||
|
||||
def populate_ipv6_interfaces(self, data):
|
||||
for key, value in iteritems(data):
|
||||
if key is None:
|
||||
break
|
||||
if 'ipv6' not in self.facts['interfaces'][key]:
|
||||
self.facts['interfaces'][key]['ipv6'] = list()
|
||||
addr, subnet = value['address'].split("/")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
bad command name address (line 1 column 7)
|
|
@ -107,3 +107,13 @@ class TestRouterosFactsModule(TestRouterosModule):
|
|||
self.assertEqual(
|
||||
len(result['ansible_facts']['ansible_net_neighbors'].keys()), 4
|
||||
)
|
||||
|
||||
def test_routeros_facts_interfaces_no_ipv6(self):
|
||||
fixture = load_fixture(
|
||||
'routeros_facts/ipv6_address_print_detail_without-paging_no-ipv6'
|
||||
)
|
||||
interfaces = self.module.Interfaces(module=self.module)
|
||||
addresses = interfaces.parse_addresses(data=fixture)
|
||||
result = interfaces.populate_ipv6_interfaces(data=addresses)
|
||||
|
||||
self.assertEqual(result, None)
|
||||
|
|
Loading…
Reference in a new issue