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

[BUG] Active maintenance task list crashes when tasks contain deleted IP devices #2071

Closed
lunkwill42 opened this issue Dec 19, 2019 · 0 comments
Assignees
Milestone

Comments

@lunkwill42
Copy link
Member

Describe the bug
If any IP device attached to an existing and active maintenance task is deleted from NAV, the active maintenance task view will crash with a AttributeError.

To Reproduce
Steps to reproduce the behavior:

  1. Create a temporary IP Device called "A"
  2. Add A to a maintenance task (e.g. immediate maintenance)
  3. Go to the maintenance tool and click the "Active tab"
  4. See error

Expected behavior
A list of active maintenance tasks should be displayed, no matter whether they have missing components.

Traceback

Internal Server Error: /maintenance/active/

AttributeError at /maintenance/active/
'DoesNotExist' object has no attribute 'message'

Request Method: GET
Request URL: https://nav.example.org/maintenance/active/
Django Version: 1.11.26
Python Executable: /usr/bin/uwsgi-core
Python Version: 3.5.3
Python Path: ['.', '', '/opt/venvs/nav/lib/python35.zip', '/opt/venvs/nav/lib/python3.5', '/opt/venvs/nav/lib/python3.5/plat-x86_64-linux-gnu', '/opt/venvs/nav/lib/python3.5/lib-dynload', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/opt/venvs/nav/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/opt/venvs/nav/lib/python3.5/site-packages', '/etc/nav/python']
Server time: Wed, 18 Dec 2019 09:37:04 +0100
Installed Applications:
('nav.models',
 'nav.web',
 'nav.django',
 'django.contrib.staticfiles',
 'django.contrib.sessions',
 'django.contrib.humanize',
 'django_filters',
 'crispy_forms',
 'crispy_forms_foundation',
 'rest_framework',
 'nav.auditlog',
 'nav.web.macwatch',
 'nav.web.geomap',
 'nav.web.portadmin',
 'django.contrib.postgres')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'nav.web.auth.AuthenticationMiddleware',
 'nav.web.auth.AuthorizationMiddleware',
 'nav.django.legacy.LegacyCleanupMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:  

File "/opt/venvs/nav/lib/python3.5/site-packages/nav/web/maintenance/views.py" in active
  130.                     netbox = Netbox.objects.get(pk=int(netbox_id))

File "/opt/venvs/nav/lib/python3.5/site-packages/django/db/models/manager.py" in manager_method
  85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/opt/venvs/nav/lib/python3.5/site-packages/django/db/models/query.py" in get
  380.                 self.model._meta.object_name
  
    
      During handling of the above exception (Netbox matching query does not exist.), another exception occurred:
    
  

File "/opt/venvs/nav/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/opt/venvs/nav/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/opt/venvs/nav/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/venvs/nav/lib/python3.5/site-packages/nav/web/maintenance/views.py" in active
  133.                                   netbox_id, get_ex.message)

Exception Type: AttributeError at /maintenance/active/
Exception Value: 'DoesNotExist' object has no attribute 'message'

Environment (please complete the following information):

  • NAV version installed: 5.0.2
@lunkwill42 lunkwill42 added this to the 5.0.3 milestone Dec 19, 2019
@lunkwill42 lunkwill42 self-assigned this Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant