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 when launching mass upgrade operation #254

Open
ghost opened this issue May 9, 2024 · 2 comments
Open

Bug when launching mass upgrade operation #254

ghost opened this issue May 9, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented May 9, 2024

Tried to create a mass upgrade operation. On the firmware object I had previously added a build, deleted it then added a new binary. Upon clicking Launch Mass Upgrade I got the 500 error, and found this in the openwisp2.log

WARNING 2024-05-10 05:40:26,890] module: log, process: 801933, thread: 139997877368384
Bad Request: /api/v1/monitoring/device/3a2ed7a8d3504c639408d317ae68fbb3/

[ERROR 2024-05-10 05:40:27,442] module: log, process: 801933, thread: 139998164637504
Internal Server Error: /admin/firmware_upgrader/build/
Traceback (most recent call last):
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/contrib/admin/options.py", line 688, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/contrib/admin/sites.py", line 242, in inner
    return view(request, *args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/contrib/admin/options.py", line 1983, in changelist_view
    response = self.response_action(
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/contrib/admin/options.py", line 1593, in response_action
    response = func(self, request, queryset)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/openwisp_firmware_upgrader/admin.py", line 180, in upgrade_selected
    result = BatchUpgradeOperation.dry_run(build=build)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/openwisp_firmware_upgrader/base/models.py", line 446, in dry_run
    firmwareless_devices = build._find_firmwareless_devices()
  File "/opt/openwisp2/env/lib/python3.10/site-packages/openwisp_firmware_upgrader/base/models.py", line 193, in _find_firmwareless_devices
    boards += image.boards
  File "/opt/openwisp2/env/lib/python3.10/site-packages/openwisp_firmware_upgrader/base/models.py", line 239, in boards
    return FIRMWARE_IMAGE_MAP[self.type]['boards']
KeyError: ''
[WARNING 2024-05-10 05:40:28,142] module: log, process: 801933, thread: 139997877368384
Not Found: /api/v1/monitoring/device/25c2b7bef5864674a5adb59bcda5b454/
@nemesifier
Copy link
Member

The field self.type is empty, that shouldn't happen, but it seems it's happening here.
In order to fix this issue we need to find out a procedure of steps to follow to replicate it.

@ghost
Copy link
Author

ghost commented May 9, 2024

  1. Create a new firmware build with firmware binary
  2. Delete The firmware binary
  3. Upload a new firmware binary
  4. Try to create mass upgrade operation.

Another odd thing is when I looked at the firmware build just before deleting it, there were entries for two binaries there, the current one and the old one I thought I had deleted (although it was "blank"). So I'm unsure if the deletion actually cleared out the entry for that binary. Maybe it deleted the file, but not the entry, if that makes sense?

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

No branches or pull requests

1 participant