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 os
import re import re
from itertools import chain
from netaddr import IPAddress from netaddr import IPAddress
import netifaces import netifaces
@ -121,7 +121,9 @@ class Network():
netbox_ips = nb.ipam.ip_addresses.filter( netbox_ips = nb.ipam.ip_addresses.filter(
device=device 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: for netbox_ip in netbox_ips:
if netbox_ip.address not in all_local_ips: if netbox_ip.address not in all_local_ips:
netbox_ip.interface = None netbox_ip.interface = None