Device update #13

Merged
Solvik merged 5 commits from feature/update into master 2019-08-05 17:06:33 +02:00
Showing only changes of commit 69a9327b18 - Show all commits

View file

@ -1,6 +1,6 @@
from itertools import chain
import os
import re
from itertools import chain
from netaddr import IPAddress
import netifaces
@ -121,7 +121,9 @@ class Network():
netbox_ips = nb.ipam.ip_addresses.filter(
device=device
)
all_local_ips = list(chain.from_iterable([x['ip'] for x in self.nics if x['ip'] != None]))
all_local_ips = list(chain.from_iterable([
x['ip'] for x in self.nics if x['ip'] is not None
]))
for netbox_ip in netbox_ips:
if netbox_ip.address not in all_local_ips:
netbox_ip.interface = None