Skip to content

Unexpected error while viewing minions / comformity list #510

@duhow

Description

@duhow

Describe the bug
Unexpected Django error appeared in logs while viewing conformity list of a machine, and list of minions.
Apparently caused by a single machine status. Differs from #505
This is blocking to display all minion list.

📝 Logs

Internal Server Error: /api/conformity/render/
Traceback (most recent call last):
  File "/opt/alcali/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/alcali/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/api/views/alcali.py", line 241, in render
    if last_highstate[state]["result"] is True:
TypeError: string indices must be integers
[21/Oct/2023 03:34:30] "GET /api/conformity/render/ HTTP/1.1" 500 99100
last_highstate	'Unhandled exception running state.apply'
Traceback (most recent call last):
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/fields.py", line 102, in get_attribute
    instance = instance()
  File "/opt/alcali/.local/lib/python3.9/site-packages/api/models.py", line 173, in conformity
    if not return_item.get(state, {}).get("result"):

During handling of the above exception ('str' object has no attribute 'get'), another exception occurred:
  File "/opt/alcali/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/alcali/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/mixins.py", line 46, in list
    return Response(serializer.data)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/serializers.py", line 768, in data
    ret = super().data
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/serializers.py", line 253, in data
    self._data = self.to_representation(self.instance)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/serializers.py", line 686, in to_representation
    return [
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/serializers.py", line 687, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/opt/alcali/.local/lib/python3.9/site-packages/api/serializers.py", line 70, in to_representation
    data = super(MinionsSerializer, self).to_representation(instance)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/serializers.py", line 509, in to_representation
    attribute = field.get_attribute(instance)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/fields.py", line 457, in get_attribute
    return get_attribute(instance, self.source_attrs)
  File "/opt/alcali/.local/lib/python3.9/site-packages/rest_framework/fields.py", line 107, in get_attribute
    raise ValueError('Exception raised in callable attribute "{}"; original exception was: {}'.format(attr, exc))

Exception Type: ValueError at /api/minions/
Exception Value: Exception raised in callable attribute "conformity"; original exception was: 'str' object has no attribute 'get'

Version 3003.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions