2018-10-15 08:14:11 -05:00
|
|
|
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:
|
2018-10-16 04:05:28 -05:00
|
|
|
for params in manufacturers:
|
|
|
|
manufacturer, created = Manufacturer.objects.get_or_create(**params)
|
2018-10-15 08:14:11 -05:00
|
|
|
|
|
|
|
if created:
|
2018-10-30 04:51:43 -05:00
|
|
|
print("🏭 Created Manufacturer", manufacturer.name)
|