mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-08-09 00:04:46 +02:00
Fixed aesthetics.
This commit is contained in:
19
startup_scripts/150_rirs.py
Normal file
19
startup_scripts/150_rirs.py
Normal file
@ -0,0 +1,19 @@
|
||||
from ipam.models import RIR
|
||||
from ruamel.yaml import YAML
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
file = Path('/opt/netbox/initializers/rirs.yml')
|
||||
if not file.is_file():
|
||||
sys.exit()
|
||||
|
||||
with file.open('r') as stream:
|
||||
yaml = YAML(typ='safe')
|
||||
rirs = yaml.load(stream)
|
||||
|
||||
if rirs is not None:
|
||||
for params in rirs:
|
||||
rir, created = RIR.objects.get_or_create(**params)
|
||||
|
||||
if created:
|
||||
print("🗺️ Created RIR", rir.name)
|
Reference in New Issue
Block a user