mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-12-02 21:05:23 +01:00
15 lines
447 B
Python
15 lines
447 B
Python
|
from dcim.models import Manufacturer
|
||
|
from ruamel.yaml import YAML
|
||
|
|
||
|
with open('/opt/netbox/initializers/manufacturers.yml', 'r') as stream:
|
||
|
yaml = YAML(typ='safe')
|
||
|
manufacturers = yaml.load(stream)
|
||
|
|
||
|
if manufacturers is not None:
|
||
|
for manufacturer_params in manufacturers:
|
||
|
manufacturer, created = Manufacturer.objects.get_or_create(**manufacturer_params)
|
||
|
|
||
|
if created:
|
||
|
print("Created Manufacturer", manufacturer.name)
|
||
|
|