k01ek / netbox-devicetype-importer

Easy import DeviceTypes from github repo
Apache License 2.0
69 stars 11 forks source link

Cannot import device if manufacturer already exists #6

Closed danjaf closed 2 years ago

danjaf commented 2 years ago

Hello and thank you for coding this Netbox plugin.

I am getting an error when importing a device from the list when the manufacturer already exists within Netbox.

Example steps to reproduce issue:

Error message:

<class 'django.db.utils.IntegrityError'>

duplicate key value violates unique constraint "dcim_manufacturer_slug_key" DETAIL: Key (slug)=(fortinet) already exists.

Python version: 3.8.10 NetBox version: 3.1.10

YAML for this device:

https://github.com/netbox-community/devicetype-library/blob/master/device-types/Fortinet/FG-101F.yaml

manufacturer: Fortinet model: FortiGate 101F slug: fg-101f part_number: FG-101F u_height: 1 is_full_depth: false

The error is accurate, as there an existing slug 'fortinet' with in Netbox, with the manufacturer name of 'FORTINET'.

If I change the manufacturer name in Netbox to match the manufacturer in the YAML 'Fortinet', there is no error.

Is there a way to work around this error if the slug matches, but the manufacturer name already exists in UPPERCASE?

k01ek commented 2 years ago

Hi @danjaf ! Thank you for feedback! I think it is possible, but too complicated. Much more easier is rename existing manufacturers.

danjaf commented 2 years ago

Fair enough. Thanks for the response!