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] Maintenance tasks can no longer be edited #2783

Closed
biselx opened this issue Dec 8, 2023 · 2 comments
Closed

[BUG] Maintenance tasks can no longer be edited #2783

biselx opened this issue Dec 8, 2023 · 2 comments
Assignees
Labels

Comments

@biselx
Copy link

biselx commented Dec 8, 2023

Describe the bug
When I modify a maintenance task, I get an internal server error.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Maintenance tasks'
  2. Click on 'Active'
  3. Click on 'Description Task'
  4. Click on 'Edit'
  5. See error

Tracebacks

Traceback (most recent call last):
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.7/contextlib.py", line 74, in inner
    return func(*args, **kwds)
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/web/maintenance/views.py", line 288, in edit
    if component_keys_errors:
UnboundLocalError: local variable 'component_keys_errors' referenced before assignment

Environment (please complete the following information):

  • If the problem is with the web ui: Linux or Windows, Firefox or Brave
  • OS on the NAV server : Debian 10
  • NAV version installed 5.8.3
  • Method of installation from Debian package
@lunkwill42
Copy link
Member

Thanks for the bug report! Easily reproduced on my end.

I assume this may be a regression error due to the changes in #2757, but I'll have a closer look.

@lunkwill42 lunkwill42 changed the title [BUG] Edit Maintenance task failed [BUG] Maintenance tasks can no longer be edited Dec 11, 2023
lunkwill42 added a commit to lunkwill42/nav that referenced this issue Dec 11, 2023
lunkwill42 added a commit to lunkwill42/nav that referenced this issue Dec 11, 2023
Due to the convoluted logic of the edit() function, multiple variables
may be referenced before proper assignment unless they are given a
value of `None` first.

Unfortunately, at least two such variables were potentially referenced
without being initialized first (among other things, causing the
crash mentioned in Uninett#2783).

This ensures all variables that may remain "unassigned" are initialized
to `None` at the start of the function.
@lunkwill42
Copy link
Member

Fixed by #2784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants