Netbox: Bulk edit of pass-through ports not saving when ports 1 and 2 selected

Created on 19 Feb 2019  路  6Comments  路  Source: netbox-community/netbox

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.6

Bulk-editing of pass-through ports does not save if ports 1 and 2 are selected in the range of ports to edit. If all ports are selected except 1 and 2, changes do save. This occurs with Front and Rear ports.

Steps to Reproduce

  1. Navigate in the system to one of our patch panels.
  2. Scroll down to either Front Ports or Rear Ports.
  3. Click check box next to "Name" to select all ports.
  4. Scroll down and click "Edit" underneath the section selected.
  5. On the bulk edit page, change any setting - doesn't matter which.
  6. Click Apply.
  7. Browser does not navigate away from the page. What you had attempted to change does not in fact change.
  8. Go back to the patch panel page, scroll down to the Front Ports or Rear Ports section and click the check box next to "Name".
  9. Uncheck ports 1 and 2.
  10. Scroll down and click "Edit".
  11. Edit anything - description, type, etc.
  12. Click Apply - your changes have now been saved.

** This also works if you just randomly select any port in the list, so long as you do not select port 1 or 2.


The expect behavior is that when clicking Apply, the changes I entered would be applied.


Changes were not saved. The same bulk edit page was displayed again without any changes.

accepted bug

All 6 comments

I'm not able to reproduce this. This part:

  1. Browser does not navigate away from the page

suggests to me that it's a browser issue. The "Apply" button is just a regular <button type="submit"> element; there's no Javascript involved.

I see that you've already got a thread going on the mailing list, so I'm going to close this out for now and continue the discussion there. If we find a way to reproduce the behavior, I'll reopen this issue.

Per Brian Candler on the mailing list:

OK, I can reproduce this now!

  • pick any device
  • add rearports using pattern [1-96]. Defaults for all other fields.
  • back at the device, select all rearports (using the checkbox which selects all)
  • select Edit
  • select type 100 Punch
  • click Apply

The page just refreshes.

Per Brian Candler on the mailing list:

OK, I can reproduce this now!

  • pick any device
  • add rearports using pattern [1-96]. Defaults for all other fields.
  • back at the device, select all rearports (using the checkbox which selects all)
  • select Edit
  • select type 100 Punch
  • click Apply

The page just refreshes.

Yes!! That's it!!

Boy that's a weird one. Nice work! Found the issue:

class RearPortBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=Interface.objects.all(),
        widget=forms.MultipleHiddenInput()
    )

The form is checking the specified primary keys against Interfaces instead of RearPorts.

Sneaky little bugger - I'm glad you found it in the code so quickly!

Fixed this and also added an error dump at the top of the page to hopefully make troubleshooting future bugs easier. Thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markve-sa picture markve-sa  路  4Comments

tyler-8 picture tyler-8  路  3Comments

aarjbdea picture aarjbdea  路  3Comments

billyzoellers picture billyzoellers  路  3Comments

Ali-Yazdani picture Ali-Yazdani  路  3Comments