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

Device with connected interface can not be deleted #2381

Closed
Armadill0 opened this issue Aug 21, 2018 · 2 comments
Closed

Device with connected interface can not be deleted #2381

Armadill0 opened this issue Aug 21, 2018 · 2 comments

Comments

@Armadill0
Copy link

Armadill0 commented Aug 21, 2018

Environment

  • Python version: 2.7.9
  • NetBox version: 2.4.3

Steps to Reproduce

  1. create a device with a physical interface
  2. create interface connection to another device
  3. delete the device

This is not reproducible with all devices with interface connections we have in our database. I tried it at least 50 or 60 times with many different devices (old and newly created). It is always reproducible with the affected devices, but I could not find common similarities and strict differences between the affected and not affected devices.

I also found #2323 and it seems to be nearly the same issue but with devices instead of virtual machines.

Expected Behavior

Device should have been successfully deleted with all it's interfaces.

If all interfaces with existing connections to other interfaces are being deleted and you delete the device afterwards everything works as expected.

Observed Behavior

Server error:
netbox-device-with-connection-not-deletable

Stack trace:

2018-08-21 14:37:21,894 ERROR Internal Server Error: /dcim/devices/1581/delete/
Traceback (most recent call last):
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/contrib/auth/mixins.py", line 92, in dispatch
    return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/webapps/netbox/netbox/utilities/views.py", line 280, in post
    obj.delete()
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/db/models/base.py", line 974, in delete
    return collector.delete()
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/db/models/deletion.py", line 308, in delete
    sender=model, instance=obj, using=self.using
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 193, in send
    for receiver in self._live_receivers(sender)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/utils/functional.py", line 15, in _curried
    return _curried_func(*(args + moreargs), **dict(kwargs, **morekwargs))
  File "/opt/webapps/netbox/netbox/extras/middleware.py", line 37, in _record_object_deleted
    instance.log_change(request.user, request.id, OBJECTCHANGE_ACTION_DELETE)
  File "/opt/webapps/netbox/netbox/dcim/models.py", line 2088, in log_change
    related_object=interface.parent,
  File "/opt/webapps/netbox/netbox/dcim/models.py", line 1960, in parent
    return self.device or self.virtual_machine
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py", line 184, in __get__
    rel_obj = self.get_object(instance)
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py", line 159, in get_object
    return qs.get(self.field.get_reverse_related_filter(instance))
  File "/opt/virtualenvs/webapps_netbox/local/lib/python2.7/site-packages/django/db/models/query.py", line 380, in get
    self.model._meta.object_name
DoesNotExist: Device matching query does not exist.
@jeremystretch
Copy link
Member

It is always reproducible with the affected devices

I have not been able to reproduce this issue since #2323 was addresses in v2.4.2. Please provide the exact steps needed to recreate one of these devices.

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Aug 21, 2018
@Armadill0
Copy link
Author

I had no more time for further investigation on this issue. Fortunately this seems to be solved with 2.4.4. Maybe #2353 fixed this.

@jeremystretch jeremystretch removed the status: revisions needed This issue requires additional information to be actionable label Jan 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants