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

Can't Merge Branch When Interfaces Have Custom Fields #94

Closed
adparis99 opened this issue Sep 9, 2024 · 4 comments · Fixed by #106
Closed

Can't Merge Branch When Interfaces Have Custom Fields #94

adparis99 opened this issue Sep 9, 2024 · 4 comments · Fixed by #106
Assignees
Labels
type: bug A confirmed report of unexpected behavior in the application

Comments

@adparis99
Copy link

adparis99 commented Sep 9, 2024

Plugin Version

0.4.0

NetBox Version

4.1.0

Python Version

3.10.12

Steps to Reproduce

  1. Create an optional custom field on the interface model
  2. Create and activate a new branch
  3. Create new interfaces (in my case associated with a few newly created devices). The custom field is not populated.
  4. Attempt to merge branch

Expected Behavior

The branch should merge successfully.

Observed Behavior

I receive essentially the same error mentioned in issue #80:
image

{
    "log": [
        "Merging branch COR - New Equipment (branch_38u5jdzs)",
        "Found 247 changes to merge",
        "Setting branch status to merging",
        "Interface has no field named 'custom_fields'"
    ]
}

Edit: Added clarification that the custom field was not required nor populated for the newly created interfaces.
Edit 2: Added additional findings and steps to reproduce below.

@adparis99 adparis99 added the type: bug A confirmed report of unexpected behavior in the application label Sep 9, 2024
@adparis99
Copy link
Author

adparis99 commented Sep 9, 2024

After some more trial and error, I've found a more specific set of Steps to Reproduce. It seems like if I simply create those interfaces and do nothing else, merges go through. But if I adjust an attribute (the ones I've tested being description and mac), then I get the error above.

Steps to Reproduce

  1. Create an optional custom field on the interface model
  2. Create and activate a new branch
  3. Create new interfaces (in my case associated with a few newly created devices). The custom field is not populated.
  4. Edit an attribute of the interface (for example, the description)
  5. Attempt to merge branch

@adparis99
Copy link
Author

One more thing I noticed in troubleshooting - based on the Changes Ahead tab, it seems that when the objects are initially created in a branch, their custom_felds attribute is completely empty. It's not until I edit and save an interface that custom_fields are filled with the default None value.

image

@jeremystretch
Copy link
Contributor

I'm still having trouble narrowing down the exact steps needed to reproduce this. Currently waiting on the fix for #102 to be merged, which will assist in troubleshooting.

@jeremystretch jeremystretch self-assigned this Sep 10, 2024
@jeremystretch
Copy link
Contributor

jeremystretch commented Sep 10, 2024

Ok, I'm able to consistently reproduce this now by doing the following:

  1. Create an optional custom field on the interface model
  2. Create and activate a new branch
  3. Edit an existing interface and set a value for the custom field
  4. Attempt to merge the branch

This raises the exception:

FieldDoesNotExist("Interface has no field named 'custom_fields'")

Strangely, this does not occur when creating a new interface with the custom field value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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