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] Deleting DeviceConnection object for a device with DeviceFirmareImage raises HTTP 500 error #250

Open
pandafy opened this issue Feb 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pandafy
Copy link
Member

pandafy commented Feb 16, 2024

Steps to replicate

  1. Ensure that you have a celery worker running in the background
  2. Create a device
  3. Add a credential to this device from the "Credentials" tab and save the form.
  4. Add a firmware to this device from the "Firmware" tab and save the form. This step will create an UpgradeOperation for this device. Verify this from the "Upgrade Operations" tab.
  5. Delete the credentials from the "Credentials" tab and save the form.
  6. Try saving the form again

Actual Outcome

The application returns HTTP 500 response because of this error

Traceback (most recent call last):
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/contrib/admin/options.py", line 688, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 242, in inner
    return view(request, *args, **kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/openwisp_controller/config/admin.py", line 138, in change_view
    return super().change_view(request, object_id, form_url, extra_context)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/reversion/admin.py", line 162, in change_view
    return super().change_view(request, object_id, form_url, extra_context)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/openwisp_utils/admin.py", line 133, in change_view
    return super().change_view(
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1889, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
    response = view_func(request, *args, **kwargs)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1747, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1797, in _changeform_view
    if all_valid(formsets) and form_validated:
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/formsets.py", line 579, in all_valid
    return all([formset.is_valid() for formset in formsets])
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/formsets.py", line 579, in <listcomp>
    return all([formset.is_valid() for formset in formsets])
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/formsets.py", line 384, in is_valid
    self.errors
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/formsets.py", line 366, in errors
    self.full_clean()
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/formsets.py", line 429, in full_clean
    form_errors = form.errors
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/forms.py", line 196, in errors
    self.full_clean()
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/forms.py", line 435, in full_clean
    self._post_clean()
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/forms/models.py", line 486, in _post_clean
    self.instance.full_clean(exclude=exclude, validate_unique=False)
  File "/home/pandafy/openwisp/venv-firmware/lib/python3.8/site-packages/django/db/models/base.py", line 1477, in full_clean
    self.clean()
  File "/home/pandafy/openwisp/openwisp-firmware-upgrader/openwisp_firmware_upgrader/base/models.py", line 69, in clean
    self.validate_upgrade_options()
  File "/home/pandafy/openwisp/openwisp-firmware-upgrader/openwisp_firmware_upgrader/base/models.py", line 56, in validate_upgrade_options
    if not getattr(self.upgrader_class, 'SCHEMA'):

Exception Type: AttributeError at /admin/config/device/e879d06b-672f-44c9-aa5e-561c56492663/change/
Exception Value: 'NoneType' object has no attribute 'SCHEMA'
@pandafy pandafy added the bug Something isn't working label Feb 16, 2024
@pandafy
Copy link
Member Author

pandafy commented Feb 16, 2024

This is partially related to #249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do (general)
Development

No branches or pull requests

1 participant