mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-29 14:28:15 +02:00
Handle IP addresses configured on disappeared interfaces (#391)
* Handle IP addresses configured on disappeared interfaces * Handle IP addresses configured on disappeared interfaces Always set type property, add changelog fragment * Handle IP addresses configured on disappeared interfaces (wording) Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Claudio Luck <claudio.luck@datact.ch> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
fb070e4ac6
commit
f6aeae1abd
2 changed files with 17 additions and 3 deletions
|
@ -317,8 +317,10 @@ class Interfaces(FactsBase):
|
|||
def populate_addresses(self, data, family):
|
||||
for value in data:
|
||||
key = value['interface']
|
||||
if family not in self.facts['interfaces'][key]:
|
||||
self.facts['interfaces'][key][family] = []
|
||||
iface = self.facts['interfaces'].setdefault(key, (
|
||||
{"type": "ansible:unknown"} if key.startswith('*') else
|
||||
{"type": "ansible:mismatch"}))
|
||||
iface_addrs = iface.setdefault(family, [])
|
||||
addr, subnet = value['address'].split('/')
|
||||
subnet = subnet.strip()
|
||||
# Try to convert subnet to an integer
|
||||
|
@ -328,7 +330,7 @@ class Interfaces(FactsBase):
|
|||
pass
|
||||
ip = dict(address=addr.strip(), subnet=subnet)
|
||||
self.add_ip_address(addr.strip(), family)
|
||||
self.facts['interfaces'][key][family].append(ip)
|
||||
iface_addrs.append(ip)
|
||||
|
||||
def add_ip_address(self, address, family):
|
||||
if family == 'ipv4':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue