Fixed aesthetics.
This commit is contained in:
parent
4cb5b9f20d
commit
0b5214d247
29 changed files with 67 additions and 40 deletions
19
startup_scripts/190_prefix_vlan_roles.py
Normal file
19
startup_scripts/190_prefix_vlan_roles.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from ipam.models import Role
|
||||
from ruamel.yaml import YAML
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
file = Path('/opt/netbox/initializers/prefix_vlan_roles.yml')
|
||||
if not file.is_file():
|
||||
sys.exit()
|
||||
|
||||
with file.open('r') as stream:
|
||||
yaml = YAML(typ='safe')
|
||||
roles = yaml.load(stream)
|
||||
|
||||
if roles is not None:
|
||||
for params in roles:
|
||||
role, created = Role.objects.get_or_create(**params)
|
||||
|
||||
if created:
|
||||
print("⛹️ Created Prefix/VLAN Role", role.name)
|
Loading…
Add table
Add a link
Reference in a new issue