pulp / pulp/pulpcore

500 error when the listing all domains and filtering by name 'default'

Open
#5,364 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue
Dominant language
Python
Stars
598
Forks
168
Avg merge
1d 4h
Merged PRs (30d)
86

Description

pulpcore 3.52.0 is producing a 500 error when the listing all domains and filtering by name 'default'.

The default domain has S3 configured.

pulp [da4add42-2e9c-4c30-8349-37c4ddeb945a]: django.request:ERROR: Internal Server Error: /api/pulp/default/api/v3/domains/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/rest_framework/fields.py", line 439, in get_attribute
    return get_attribute(instance, self.source_attrs)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/fields.py", line 104, in get_attribute
    instance = instance[attr]
KeyError: 'location'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 124, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/mixins.py", line 43, in list
    return self.get_paginated_response(serializer.data)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 795, in data
    ret = super().data
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 249, in data
    self._data = self.to_representation(self.instance)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 713, in to_representation
    return [
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 714, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 538, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/usr/local/lib/python3.9/site-packages/pulpcore/app/serializers/domain.py", line 342, in to_representation
    return serializer.data
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 571, in data
    ret = super().data
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 249, in data
    self._data = self.to_representation(self.instance)
  File "/usr/local/lib/python3.9/site-packages/pulpcore/app/serializers/domain.py", line 46, in to_representation
    return super().to_representation(instance)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 525, in to_representation
    attribute = field.get_attribute(instance)
  File "/usr/local/lib/python3.9/site-packages/rest_framework/fields.py", line 472, in get_attribute
    raise type(exc)(msg)
KeyError: "Got KeyError when attempting to get a value for field `location` on serializer `FileSystemSettingsSerializer`.\nThe serializer field might be named incorrectly and not match any attribute or key on the `dict` instance.\nOriginal exception text was: 'location'."
('pulp [da4add42-2e9c-4c30-8349-37c4ddeb945a]: ::ffff:10.128.4.159 - contentsources [13/May/2024:08:05:19 +0000] "GET /api/pulp/default/api/v3/domains/?name=default HTTP/1.1" 500 145 "-" "OpenAPI-Generator/de24b382d968bd5ed3a4252b36e47596388ab51b7a98d596b8e3294aa65e495a/go"',)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pulpcore/app/serializers/domain.py, especially FileSystemSettingsSerializer and the domain representation path shown in the traceback. Reproduce GET /api/pulp/default/api/v3/domains/?name=default with S3 configured; done means the request no longer returns 500 and the domain response is serialized successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.