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

Circuit Termination with A and Z Swap broken with 1.3.x #2326

Closed
smk4664 opened this issue Aug 28, 2022 · 3 comments · Fixed by #2515
Closed

Circuit Termination with A and Z Swap broken with 1.3.x #2326

smk4664 opened this issue Aug 28, 2022 · 3 comments · Fixed by #2515
Assignees
Labels
type: bug Something isn't working as expected

Comments

@smk4664
Copy link
Contributor

smk4664 commented Aug 28, 2022

Environment

  • Nautobot version (Docker tag too if applicable): 1.3.1
  • Python version: 3.8
  • Database platform, version:
  • Middleware(s):

Steps to Reproduce

  1. Create a Circuit with two terminations
  2. Click the Swap termination button.

Expected Behavior

The terminations will swap sides.

Observed Behavior

image
Server Error: Circuit has no field named 'termination__'

@smk4664
Copy link
Contributor Author

smk4664 commented Aug 28, 2022

Notice the termination__ is two underscores. In order to avoid a Unique Constraint issue when performing the swap, we set the term_side to _, but when we call save, it is getting picked up by signals.py where the circuit gets filtered by termination__:

    fields = {
        "last_updated": timezone.now(),
        f"termination_{instance.term_side.lower()}": instance.pk,
    }
    Circuit.objects.filter(pk=instance.circuit_id).update(**fields)

@smk4664
Copy link
Contributor Author

smk4664 commented Aug 28, 2022

Also, unfortunately there are no tests for the CircuitSwapTerminations, so this did not get caught by tests.

@glennmatthews
Copy link
Contributor

Looks to have been introduced by #1144. Appears that a similar regression was fixed in NetBox by netbox-community/netbox@a4955b4.

@glennmatthews glennmatthews added type: bug Something isn't working as expected group: circuits labels Aug 29, 2022
@timizuoebideri1 timizuoebideri1 self-assigned this Sep 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants