Update VLAN Initializer for Netbox 2.7

The VLAN 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 vlans.yml file as follows:

- Make sure the status is spelled lowercase.

See the diff of this commit for further information how this is meant.
This commit is contained in:
Christian Mäder 2020-01-17 15:59:21 +01:00
parent 4a58676647
commit 8d8b9a157e
2 changed files with 10 additions and 9 deletions

View file

@ -1,6 +1,5 @@
from dcim.models import Site
from ipam.models import VLAN, VLANGroup, Role
from ipam.constants import VLAN_STATUS_CHOICES
from tenancy.models import Tenant, TenantGroup
from extras.models import CustomField, CustomFieldValue
from ruamel.yaml import YAML
@ -35,12 +34,6 @@ with file.open('r') as stream:
params[assoc] = model.objects.get(**query)
if 'status' in params:
for vlan_status in VLAN_STATUS_CHOICES:
if params['status'] in vlan_status:
params['status'] = vlan_status[0]
break
vlan, created = VLAN.objects.get_or_create(**params)
if created: