2020-12-29 15:24:16 -06:00
|
|
|
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:
|
2020-12-29 17:27:41 -06:00
|
|
|
set_custom_fields_values(provider, custom_field_data)
|
2020-12-29 15:24:16 -06:00
|
|
|
|
|
|
|
print("📡 Created provider", provider.name)
|