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

PROTECT Method Breaks New Log Cleanup Job #528

Closed
cmong-nextech opened this issue Aug 29, 2024 · 3 comments · Fixed by #532
Closed

PROTECT Method Breaks New Log Cleanup Job #528

cmong-nextech opened this issue Aug 29, 2024 · 3 comments · Fixed by #532
Assignees
Labels
status: accepted This issue has been accepted by the maintainers team for implementation type: bug Issues/PRs addressing a bug.

Comments

@cmong-nextech
Copy link

Environment

  • Python version: 3.11
  • Nautobot version: 2.3.1
  • nautobot-ssot version: 2.7.0

Expected Behavior

Log Cleanup job runs without issue.

Observed Behavior

Job fails and references the SSOT FK Sync.job_result

Steps to Reproduce

  1. Utilize the SSOT plugin to sync something to nautobot, creating a job log in the process.
  2. Run the Log Cleanup job introduced into Nautobot in version 2.3.1
  3. Witness the following error:
{
    "exc_message": [
        "Cannot delete some instances of model 'JobResult' because they are referenced through protected foreign keys: 'Sync.job_result'.",
        [
            {
                "__nautobot_type__": "nautobot_ssot.models.Sync",
                "display": "Sync Network Data From Network → Nautobot, 2024-07-31 23:43",
                "id": "b9a07bc5-1640-43b7-b701-b6f947102016"
            },
@Kircheneer
Copy link
Contributor

We could change the foreign key from Sync to cascade when the JobResult is deleted and put a warning into the docs about this. This would in my mind be the most straight-forward behavior. @jdrew82, @glennmatthews any thoughts?

@Kircheneer Kircheneer added status: accepted This issue has been accepted by the maintainers team for implementation type: bug Issues/PRs addressing a bug. labels Sep 2, 2024
@glennmatthews
Copy link
Contributor

Sounds appropriate to me.

@jdrew82
Copy link
Contributor

jdrew82 commented Sep 3, 2024

We could change the foreign key from Sync to cascade when the JobResult is deleted and put a warning into the docs about this. This would in my mind be the most straight-forward behavior. @jdrew82, @glennmatthews any thoughts?

I agree that this makes the most sense.

@jdrew82 jdrew82 self-assigned this Sep 6, 2024
@jdrew82 jdrew82 linked a pull request Sep 6, 2024 that will close this issue
@jdrew82 jdrew82 mentioned this issue Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted This issue has been accepted by the maintainers team for implementation type: bug Issues/PRs addressing a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants