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

Relationship Associations remain when associated objects are deleted #460

Closed
pke11y opened this issue May 17, 2021 · 0 comments · Fixed by #593
Closed

Relationship Associations remain when associated objects are deleted #460

pke11y opened this issue May 17, 2021 · 0 comments · Fixed by #593
Assignees
Labels
type: bug Something isn't working as expected

Comments

@pke11y
Copy link
Contributor

pke11y commented May 17, 2021

Environment

  • Python version: 3.8.5
  • Nautobot version: v1.0.1

Steps to Reproduce

  1. Create a many-to-many relationship between ipam.vlan and ipam.vlan_groups
  2. Create multiple VLANs in site-X
  3. Create a Vlan Group in site-X
  4. Create associations by assigning VLANs to the VLAN Group
  5. Delete the VLAN Group object

Relationship

        {
            "id": "f33aac1f-3b3c-4d35-89e4-a6a565a6594c",
            "url": "http://127.0.0.1/api/extras/relationships/f33aac1f-3b3c-4d35-89e4-a6a565a6594c/",
            "name": "vlan-vlangroup",
            "slug": "vlan-vlangroup",
            "description": "VLAN to VLAN Group mapping",
            "type": "many-to-many",
            "source_type": "ipam.vlan",
            "source_label": "",
            "source_hidden": false,
            "source_filter": {
                "site": "brq2"
            },
            "destination_type": "ipam.vlangroup",
            "destination_label": "",
            "destination_hidden": false,
            "destination_filter": null
        }

Expected Behavior

Any relationship associations including the deleted VLAN Group, should also be deleted.

Observed Behavior

All relationship associations remain in the database.

        {
            "id": "cb2f5c23-e323-4d6e-bf41-62be5ec30c26",
            "relationship": {
                "id": "f33aac1f-3b3c-4d35-89e4-a6a565a6594c",
                "url": "http://127.0.0.1/api/extras/relationships/f33aac1f-3b3c-4d35-89e4-a6a565a6594c/",
                "name": "vlan-vlangroup",
                "slug": "vlan-vlangroup",
                "display": "vlan-vlangroup"
            },
            "source_type": "ipam.vlan",
            "source_id": "15cda72f-bdb8-5d9c-88d8-17c6d5fdd979",
            "destination_type": "ipam.vlangroup",
            "destination_id": "fa0eecbd-fcc1-4435-9d44-72e31554f176"
        },

NOTE: no VLANs exist with the native 1:M mapping during the procedure.

The relationships are available to view on the UI. The VLAN Group target object is None on the UI.

Screenshot 2021-05-17 at 14 39 49

@jedelman8 jedelman8 added type: bug Something isn't working as expected status: accepted labels May 19, 2021
@glennmatthews glennmatthews self-assigned this Jun 18, 2021
@glennmatthews glennmatthews changed the title Relationship Associations remain when Relationship objects deleted Relationship Associations remain when associated objects are deleted Jun 18, 2021
glennmatthews added a commit that referenced this issue Jun 18, 2021
glennmatthews added a commit that referenced this issue Jun 23, 2021
…ciations (#593)

* Fix #460: ensure that deleting a record deletes its associated RelationshipAssociations

* Add related_query_name to GenericRelations and associated testing.

* Add keepdb option when running tests as a whole
glennmatthews added a commit that referenced this issue Jun 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2021
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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants