mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-08-09 08:05:08 +02:00
Ignore missing initializers
Previously, the startup_scripts would fail if an initializer file was not present. Now they just ignore missing files.
This commit is contained in:
@ -6,7 +6,14 @@ from tenancy.models import Tenant
|
||||
from extras.models import CustomField, CustomFieldValue
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
with open('/opt/netbox/initializers/devices.yml', 'r') as stream:
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
file = Path('/opt/netbox/initializers/devices.yml')
|
||||
if not file.is_file():
|
||||
sys.exit()
|
||||
|
||||
with file.open('r') as stream:
|
||||
yaml = YAML(typ='safe')
|
||||
devices = yaml.load(stream)
|
||||
|
||||
|
Reference in New Issue
Block a user