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

Unable to delete custom field on object type from a plugin that has been removed #17406

Closed
goteamkor opened this issue Sep 6, 2024 · 1 comment · Fixed by #17491
Closed
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@goteamkor
Copy link

goteamkor commented Sep 6, 2024

Deployment Type

Self-hosted

NetBox Version

v.4.1.0

Python Version

3.10

Steps to Reproduce

Install a plugin that adds object types (ex: netbox_data_flows)
Create a custom field, assign custom field to an object type from the plugin
Remove the plugin
Delete the custom field

image

Expected Behavior

Custom field should be deleted.

Observed Behavior

image

@goteamkor goteamkor added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Sep 6, 2024
@goteamkor goteamkor changed the title Unable to delete custom field from a plugin that has been removed Unable to delete custom field on object from a plugin that has been removed Sep 6, 2024
@goteamkor goteamkor changed the title Unable to delete custom field on object from a plugin that has been removed Unable to delete custom field on object type from a plugin that has been removed Sep 6, 2024
@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Sep 11, 2024
@arthanson
Copy link
Collaborator

  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/netbox/netbox/views/generic/base.py", line 77, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/netbox/utilities/views.py", line 125, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/netbox/utilities/views.py", line 39, in dispatch
    return super().dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/netbox/netbox/views/generic/bulk_views.py", line 863, in post
    obj.delete()
  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/db/models/base.py", line 1183, in delete
    return collector.delete()
           ^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/db/models/deletion.py", line 463, in delete
    signals.pre_delete.send(
  File "/Users/arthurhanson/dev/work/netbox/venv/lib/python3.11/site-packages/django/dispatch/dispatcher.py", line 189, in send
    response = receiver(signal=self, sender=sender, **named)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arthurhanson/dev/work/netbox/netbox/extras/signals.py", line 50, in handle_cf_deleted
    instance.remove_stale_data(instance.object_types.all())
  File "/Users/arthurhanson/dev/work/netbox/netbox/extras/models/customfields.py", line 298, in remove_stale_data
    instances = model.objects.filter(custom_field_data__has_key=self.name)
                ^^^^^^^^^^^^^

@arthanson arthanson added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Sep 13, 2024
@arthanson arthanson self-assigned this Sep 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants