mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-08-09 16:15:08 +02:00
circuits model startup_scripts
This commit is contained in:
18
startup_scripts/280_providers.py
Normal file
18
startup_scripts/280_providers.py
Normal file
@ -0,0 +1,18 @@
|
||||
from circuits.models import Provider
|
||||
from startup_script_utils import *
|
||||
import sys
|
||||
|
||||
providers = load_yaml('/opt/netbox/initializers/providers.yml')
|
||||
|
||||
if providers is None:
|
||||
sys.exit()
|
||||
|
||||
for params in providers:
|
||||
custom_field_data = pop_custom_fields(params)
|
||||
|
||||
provider, created = Provider.objects.get_or_create(**params)
|
||||
|
||||
if created:
|
||||
set_custom_fields_values(name, custom_field_data)
|
||||
|
||||
print("📡 Created provider", provider.name)
|
Reference in New Issue
Block a user