Page MenuHomePhabricator

Error creating interfaces in netbox-next
Closed, ResolvedPublic

Description

I've hit an error when trying to add new interfaces to devices in netbox-next. I stumbled on it when testing a script I was prepping to do some of the cloudsw host moves in codfw, but I also get the same thing using the GUI.

Steps to replicate:

  • Open a device's page
  • Click 'Add Components... Interface'
  • Enter a name for the interface, and select a type
  • Click 'Create'

You will hit the following error:

netbox_next_create_int.jpg (542×1 px, 49 KB)

Testing with the API this was how I could trigger it:

device = nb.dcim.devices.get(name='cloudsw1-b1-codfw')
new_sw_int = nb.dcim.interfaces.create(name='ge-0/0/17', device=device.id, type='1000base-t')

With same response:

pynetbox.core.query.RequestError: The request failed with code 500 Internal Server Error: {'error': 'Interface objects need to have a primary key value before you can access their tags.', 'exception': 'ValueError', 'netbox_version': '3.2.9', 'python_version': '3.9.2'}

Looks to be a bug in v3.2.9? I can open an issue upstream but wanted to double-check with the rest of the team that there may not be a cause specific to our deployment first. I had a search on the netbox Github and couldn't see an existing open issue on it.

Event Timeline

cmooney triaged this task as Medium priority.Mar 28 2023, 8:04 AM
cmooney created this task.
cmooney lowered the priority of this task from Medium to Low.Mar 28 2023, 8:35 AM

Had a quick chat with @ayounsi on irc about this, seems it's related to some of the validation scripts, should be easy to fix.

@ayounsi I think this error I'm hitting is possibly similar:

pynetbox.core.query.RequestError: The request failed with code 500 Internal Server Error: {'error': 'Cable objects need to have a primary key value before you can access their tags.', 'exception': 'ValueError', 'netbox_version': '3.2.9', 'python_version': '3.9.2'}

Code that triggered was this, but I suspect it's the same thing with the tag validation as observed with interface creation:

new_cable = nb.dcim.cables.create(termination_a_type='dcim.interface', termination_a_id=host_int_id,
    termination_b_type='dcim.interface', termination_b_id=new_sw_int.id, color=cable_color, type=cable_type)
ayounsi claimed this task.

Thanks for the dogfooding :)

I removed the TAG check from the CR see diff: https://gerrit.wikimedia.org/r/c/operations/software/netbox-extras/+/889958/7..8

And updated netbox-extra on netbox-next to match PS8.

Feel free to re-open if the issue happens again.