Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying a Virtual Chassis fails without error message when member device is missing a required custom field #11582

Closed
tychescoin opened this issue Jan 25, 2023 · 0 comments · Fixed by #11696
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@tychescoin
Copy link

NetBox version

v3.4.3

Python version

3.10

Steps to Reproduce

  1. Create a device
  2. Create a custom field marking it as required and choosing DCIM > Device as a Content Type
  3. Create a virtual chassis adding the device created in step 1 as a member. Save the virtual chassis
  4. Edit the virtual chassis created in step 4. Make any change except removing the member device and hit OK

Same behavior occurs in the Add Member page.

  1. Create a device
  2. Create a custom field marking it as required and choosing DCIM > Device as a Content Type
  3. Create a virtual chassis without adding a member device. Save the virtual chassis
  4. Try to add the member device created in step 1 to the virtual chassis created in step 3 via the add member page.

Expected Behavior

Either the change should be applied and the browser should return the virtual chassis view page for the modified chassis or there should be an error popup indicating that a required field is missing for the member device. Given that it isn't obvious that the member device is being modified while editing the virtual chassis (especially when only trying to add a comment), applying the change would be more intuitive but the device missing a required field is an error state that could have further impact in the future so failing with a clear error message might be more beneficial.

Observed Behavior

The Edit Virtual Chassis page reloads without error message or any indication of what the issue is. The change is not applied.

It appears the missing required field on the member device is causing the formset.is_valid() check to fail in the post methods of the VirtualChassisEditView and VirtualChassisAddMemberView

@tychescoin tychescoin added the type: bug A confirmed report of unexpected behavior in the application label Jan 25, 2023
@kkthxbye-code kkthxbye-code added the status: accepted This issue has been accepted for implementation label Feb 8, 2023
kkthxbye-code pushed a commit to kkthxbye-code/netbox that referenced this issue Feb 8, 2023
### Fixes: netbox-community#11582

Not sure if this is the correct fix or not. The reason that the custom field errors were not shown is that messages.html only shows non_field_errors if the form passed to the context is named form. This is probably an issue in more places, but not sure how to make it generic. A change to messages.html would also need to support formsets.

Any input appreciated @jeremystretch or @arthanson
jeremystretch pushed a commit that referenced this issue Feb 8, 2023
### Fixes: #11582

Not sure if this is the correct fix or not. The reason that the custom field errors were not shown is that messages.html only shows non_field_errors if the form passed to the context is named form. This is probably an issue in more places, but not sure how to make it generic. A change to messages.html would also need to support formsets.

Any input appreciated @jeremystretch or @arthanson
jeremystretch added a commit that referenced this issue Feb 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants