Giter Club home page Giter Club logo

Comments (2)

glennmatthews avatar glennmatthews commented on July 18, 2024

Thanks for filing the issue! We actually just noticed this bug yesterday on the core team. :-)

The issue is in the _handle_deleted_object signal, which is being triggered when the user logs out and their session DB record gets deleted. This signal is missing logic to handle the case where the deleted object has a PK that isn't of type UUID. A first pass fix is something like:

diff --git a/nautobot/extras/signals.py b/nautobot/extras/signals.py
index 86ad2aca8..17a31217c 100644
--- a/nautobot/extras/signals.py
+++ b/nautobot/extras/signals.py
@@ -20,6 +20,7 @@ from django_prometheus.models import model_deletes, model_inserts, model_updates
 
 from nautobot.core.celery import app, import_jobs_as_celery_tasks
 from nautobot.core.utils.config import get_settings_or_config
+from nautobot.core.utils.data import is_uuid
 from nautobot.extras.choices import JobResultStatusChoices, ObjectChangeActionChoices
 from nautobot.extras.constants import CHANGELOG_MAX_CHANGE_CONTEXT_DETAIL
 from nautobot.extras.models import (
@@ -165,6 +166,10 @@ def _handle_deleted_object(sender, instance, **kwargs):
     if change_context_state.get() is None:
         return
 
+    if not is_uuid(instance.pk):
+        # Probably some system object
+        return
+
     associations = ContactAssociation.objects.filter(
         associated_object_type=ContentType.objects.get_for_model(type(instance)), associated_object_id=instance.pk
     )

but we're having some discussions about whether there may be a more elegant way to fix it.

from nautobot.

glennmatthews avatar glennmatthews commented on July 18, 2024

Fixed by #5322.

from nautobot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.