netbox-docker/startup_scripts/050_manufacturers.py
Aleksandar Radunovic aa68548f41 Add Plaform seeds
2018-10-30 14:22:04 +01:00

14 lines
423 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 params in manufacturers:
manufacturer, created = Manufacturer.objects.get_or_create(**params)
if created:
print("🏭 Created Manufacturer", manufacturer.name)