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

[1.3] Change logging needs to handle models with no associated serializer #1440

Closed
glennmatthews opened this issue Mar 2, 2022 · 2 comments · Fixed by #1443
Closed

[1.3] Change logging needs to handle models with no associated serializer #1440

glennmatthews opened this issue Mar 2, 2022 · 2 comments · Fixed by #1443
Assignees
Labels
impact: high High severity bugs causing system wide impact type: bug Something isn't working as expected
Milestone

Comments

@glennmatthews
Copy link
Contributor

glennmatthews commented Mar 2, 2022

Environment

  • Python version:
  • Nautobot version: next b44947c

Steps to Reproduce

  1. Have a model that is change-logged (implements to_objectchange or inherits from ChangeLoggedModel) but has no associated REST API serializer
  2. Create, update, or delete an instance of this model.

Expected Behavior

Change logging to succeed.

Observed Behavior

...
  File "/source/nautobot/extras/signals.py", line 72, in _handle_changed_object
    objectchange = instance.to_objectchange(action)
  File "/source/nautobot/extras/models/change_logging.py", line 43, in to_objectchange
    object_data_v2=serialize_object_v2(self),
  File "/source/nautobot/utilities/utils.py", line 152, in serialize_object_v2
    serializer_class = get_serializer_for_model(obj.__class__)
  File "/source/nautobot/utilities/api.py", line 29, in get_serializer_for_model
    "Could not determine serializer for {}.{} with prefix '{}'".format(app_name, model_name, prefix)
nautobot.core.api.exceptions.SerializerNotFound: Could not determine serializer for extras.Job with prefix ''

IMHO the to_objectchange implementation needs to catch the SerializerNotFound exception, possibly log a warning message, and gracefully recover.

@glennmatthews glennmatthews added the type: bug Something isn't working as expected label Mar 2, 2022
@glennmatthews glennmatthews added this to the v1.3.0 milestone Mar 2, 2022
@lampwins lampwins added the impact: high High severity bugs causing system wide impact label Mar 3, 2022
@glennmatthews
Copy link
Contributor Author

Issue introduced by #1389, hence this only applies to next at this time.

@bryanculver
Copy link
Member

Merged into next.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: high High severity bugs causing system wide impact type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants