Update IP Initializer for Netbox 2.7
The ip address database model has changed in Netbox 2.7. Therefore the initializer code, that was used before, broke. As a user, you will need to update your ip_addresses.yml file as follows: - Make sure the status is written in lower case. See the diff of this commit for further information how this is meant.
This commit is contained in:
parent
74a0e2cf6e
commit
27f671e41a
2 changed files with 24 additions and 13 deletions
|
@ -1,5 +1,4 @@
|
|||
from ipam.models import IPAddress, VRF
|
||||
from ipam.constants import IPADDRESS_STATUS_CHOICES
|
||||
from dcim.models import Device, Interface
|
||||
from virtualization.models import VirtualMachine
|
||||
from tenancy.models import Tenant
|
||||
|
@ -49,12 +48,6 @@ with file.open('r') as stream:
|
|||
query = { field: params.pop(assoc) }
|
||||
params[assoc] = model.objects.get(**query)
|
||||
|
||||
if 'status' in params:
|
||||
for ip_status in IPADDRESS_STATUS_CHOICES:
|
||||
if params['status'] in ip_status:
|
||||
params['status'] = ip_status[0]
|
||||
break
|
||||
|
||||
ip_address, created = IPAddress.objects.get_or_create(**params)
|
||||
|
||||
if created:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue