fix bug while testing debug with an interface not existing while updating

This commit is contained in:
Solvik Blum 2019-08-07 15:36:24 +02:00
parent 49731644fd
commit d7af66b325
No known key found for this signature in database
GPG key ID: CC12B3DC262B6C47

View file

@ -147,6 +147,11 @@ class Network():
interface = nb.dcim.interfaces.get(
mac_address=nic['mac'],
)
if not interface:
logging.info('Interface {} not found, creating..'.format(
mac_address=nic['mac'])
)
interface = self.create_netbox_nic(device, nic)
nic_update = False
if nic['name'] != interface.name: