netbox-community/customizations

multi_connect.py ValueError

trondforgaard opened this issue · 3 comments

Throws this error when accessing the script.

<class 'ValueError'>

too many values to unpack (expected 2)

Python version: 3.8.10
NetBox version: 3.2.1

The problem is that cable_status passes LinkStatusChoices.CHOICES as choices to the ChoiceVar contructor.

The VoiceVar constructor expects a list of two-tuples, while LinkStatusChoices.CHOICES is a three-tuple (The third item is the corresponding color).

I'm not sure if this should be fixed in

  • the extras.scripts module, by accepting three-tuples
  • the utilities.choices module, by providing a method or accessor that strips the 3rd element
  • the script itself, by stripping the third element itself ([(choice[0], choice[1]) for choice in choices])

This is broken for me as well. Does not work on 3.2 or later. I would love it if someone knew how to fix it...

I ended up just commenting out the "cable_status = ChoiceVar..." line and the "status=data["cable_status"]" line

The cable status field isn't that important. If I'm connecting cables, its obvious that they are "Connected", so letting the system use the default value is fine.