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

Inconsistency in ContactAssociation uniqueness constraints #5644

Closed
jdueitt opened this issue Apr 29, 2024 · 2 comments · Fixed by #5650
Closed

Inconsistency in ContactAssociation uniqueness constraints #5644

jdueitt opened this issue Apr 29, 2024 · 2 comments · Fixed by #5650
Assignees
Labels
type: bug Something isn't working as expected

Comments

@jdueitt
Copy link
Contributor

jdueitt commented Apr 29, 2024

Environment

  • Nautobot version (Docker tag too if applicable): 2.2.2
  • Python version: 3.10.12
  • Database platform, version: postgres, 16.2
  • Middleware(s):

Performing a Import Objects job on the content type of extras | contact association does not honor the same uniqueness constraints as using the form to manually enter a new association. Specifically, associated the same contact, and role to multiple objects will result in a failure using the Job, but can be done manually by going to each object and assigning the contact.

Test Data

Location Types

name
Root Location

Locations

location_type__name,name,status__name
Root Location,Location 1,Active
Root Location,Location 2,Active

Contacts

name,email
Bob,bob@example.com

Steps to Reproduce

  1. Create a CSV that associates the same contact, and role to two different objects of the same type (this requires knowing the ids of the generated locations when loading our test data, so this will change for everybody going through these steps
associated_object_id,associated_object_type,status__name,role__name,contact__name
7939407e-0dba-430b-bf54-b8d3e88258dc,dcim.location,Active,On Site,Bob
969beaa9-f75a-4b11-b6ae-15d6357cf5fe,dcim.location,Active,On Site,Bob
  1. Utilize the import objects job to import the contact associations
    NautobotContactAssociationImport-0001

Expected Behavior

The expected behavior is the form indicating that it successfully imported the contact associations.
NautobotContactAssociationImport-0003

Observed Behavior

NautobotContactAssociationImport-0002

@jdueitt jdueitt added triage This issue is new and has not been reviewed. type: bug Something isn't working as expected labels Apr 29, 2024
@jdueitt
Copy link
Contributor Author

jdueitt commented Apr 29, 2024

I will be submitting a PR shortly that fixes this issue.

@glennmatthews glennmatthews removed the triage This issue is new and has not been reviewed. label Apr 30, 2024
jdueitt added a commit to jdueitt/nautobot that referenced this issue Apr 30, 2024
jdueitt added a commit to jdueitt/nautobot that referenced this issue Apr 30, 2024
@jdueitt
Copy link
Contributor Author

jdueitt commented Apr 30, 2024

@glennmatthews the PR is now in for this. From my perspective, I have this resolved and it's not a hot button issue for me. So, no need to rush a new release out to get this rolled in.

jdueitt added a commit to jdueitt/nautobot that referenced this issue May 1, 2024
Done so that all related objects can be found and objects built at test time.
glennmatthews pushed a commit that referenced this issue May 2, 2024
* Add a test for importing contact associations (#5644)

* Align the uniqueness constraints of the model with the API serializer (#5644)

* Closes #5644: Align constraints in serializer and model

* Move the change log fragment to the proper location.

* Add Roles to the test (#5644)

Done so that all related objects can be found and objects built at test time.
edwardtheharris pushed a commit to edwardtheharris/nautobot that referenced this issue Jul 15, 2024
* Add a test for importing contact associations (nautobot#5644)

* Align the uniqueness constraints of the model with the API serializer (nautobot#5644)

* Closes nautobot#5644: Align constraints in serializer and model

* Move the change log fragment to the proper location.

* Add Roles to the test (nautobot#5644)

Done so that all related objects can be found and objects built at test time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants