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

Bug changing interface mode #2816

Merged
merged 7 commits into from Nov 21, 2022
Merged

Conversation

timizuoebideri1
Copy link
Contributor

Closes: #

What's Changed

Remove tagged_vlan validation from the model clean method to Form and Serializer because we can't know if the tagged_valn has been cleared or not. As a result, regardless of whether the tagged_valn has been cleared or not via form or API, it raises an exception.

Add validation to Form and serializer

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • Example Plugin Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

Comment on lines 186 to 189
mode = self.cleaned_data["mode"]

if mode != InterfaceModeChoices.MODE_TAGGED and tagged_vlans:
raise forms.ValidationError({"tagged_vlans": f"Clear tagged_vlans to set mode to {self.mode}"})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since tagged_vlans is auto cleared via Javascript whenever the mode is changed in UI, this is essentially redundant.

@timizuoebideri1 timizuoebideri1 self-assigned this Nov 14, 2022
@timizuoebideri1 timizuoebideri1 marked this pull request as ready for review November 14, 2022 07:13
@gsnider2195
Copy link
Contributor

After the changelog fragment is added it looks good to me.

# Conflicts:
#	nautobot/dcim/api/serializers.py
#	nautobot/virtualization/api/serializers.py
@bryanculver bryanculver self-requested a review November 21, 2022 18:46
@timizuoebideri1 timizuoebideri1 merged commit 606c0e1 into develop Nov 21, 2022
@timizuoebideri1 timizuoebideri1 deleted the bug-changing_interface_mode branch November 21, 2022 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants