netbox-community / Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
https://github.com/netbox-community/devicetype-library
MIT License
248 stars 75 forks source link

UnboundLocalError: local variable 'dt' referenced before assignment #59

Closed telematiko closed 1 year ago

telematiko commented 1 year ago

Netbox version (v3.2.8) When run ./nb-dt-import.py I get error message:

# python3 ./nb-dt-import.py
Package devicetype-library is already installed, updating /opt/netbox_device_type_import/repo
Pulled Repo https://github.com/netbox-community/devicetype-library.git
No Vendors Specified, Gathering All Device-Types
88 Vendors Found
1882 Device-Types Found
[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"slug":["manufacturer with this slug already exists."]},{},{}]
{"manufacturer":["Related object not found using the provided attributes: {'name': '3Com', 'slug': '3com'}"]}
Traceback (most recent call last):
  File "./nb-dt-import.py", line 853, in <module>
    main()
  File "./nb-dt-import.py", line 826, in main
    createDeviceTypes(deviceTypes, nb)
  File "./nb-dt-import.py", line 680, in createDeviceTypes
    dt.id, nb)
UnboundLocalError: local variable 'dt' referenced before assignment
telematiko commented 1 year ago

Also get error when use Netbox v.3.3.5

# python3 ./nb-dt-import.py
Package devicetype-library is already installed, updating /opt/netbox_device_type_import/repo
Pulled Repo https://github.com/netbox-community/devicetype-library.git
No Vendors Specified, Gathering All Device-Types
88 Vendors Found
1882 Device-Types Found
Manufacturer Exists: SNR - 20
Manufacturer Exists: Extreme Networks - 9
Manufacturer Exists: Dell - 12
Manufacturer Exists: MikroTik - 10
Manufacturer Exists: Panduit - 24
Manufacturer Exists: Huawei - 7
Manufacturer Exists: Eltex - 22
Manufacturer Exists: Cisco - 5
Manufacturer Exists: Arista - 8
Manufacturer Exists: Vertiv - 18
Manufacturer Exists: Juniper - 1
[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"slug":["manufacturer with this slug already exists."]},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{"slug":["manufacturer with this slug already exists."]},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]
{"manufacturer":["Related object not found using the provided attributes: {'name': '3Com', 'slug': '3com'}"]}
Traceback (most recent call last):
  File "./nb-dt-import.py", line 853, in <module>
    main()
  File "./nb-dt-import.py", line 826, in main
    createDeviceTypes(deviceTypes, nb)
  File "./nb-dt-import.py", line 680, in createDeviceTypes
    dt.id, nb)
UnboundLocalError: local variable 'dt' referenced before assignment
brunosofwareengineer commented 1 year ago

Workrounded pulling an specific manufacturer with --vendors. Using NB version 3.3.6 here.

danner26 commented 1 year ago

Hello @blackbicbiro, the NetBox Community will be taking over this repository. Due to the fact that this issue has been around for a very long time and we have updated the requirements within this repository as well as the new codebase for NetBox and DeviceType-Library, I am going to close it. Should you encounter any further issues, please feel free to contact us. Thank you!