Bug 2033940 - Error: AttributeError: 'NoneType' object has no attribute 'cast' thrown while listing repository versions
Summary: Error: AttributeError: 'NoneType' object has no attribute 'cast' thrown while...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.10.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-19 02:22 UTC by Krutika Kinge
Modified: 2022-09-22 03:04 UTC (History)
6 users (show)

Fixed In Version: pulpcore-3.16.4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:31:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pulp pulpcore issues 2085 0 None closed AttributeError: 'NoneType' object has no attribute 'cast' thrown when listing repostiory versions 2022-03-30 17:44:06 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:31:47 UTC

Description Krutika Kinge 2021-12-19 02:22:30 UTC
Description of problem:

After upgrade to Satellite 6.10, 'Actions::Katello::OrphanCleanup::RemoveOrphans' task is failing. Following errors are thrown while listing repository versions:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/log/messages

Dec 16 07:34:12 xxx pulpcore-api: pulp [aaa-aaaaa-aaaaaa-aaaaaa-aaaaaaaa]: django.request:ERROR: Internal Server Error: /pulp/api/v3/repositories/rpm/rpm/c6963cf8-4a81-4b18-94e9-651ec8a07319/versions/
Dec 16 07:34:12 xxx pulpcore-api: Traceback (most recent call last):
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
Dec 16 07:34:12 xxx pulpcore-api: response = get_response(request)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
Dec 16 07:34:12 xxx pulpcore-api: response = self.process_exception_by_middleware(e, request)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
Dec 16 07:34:12 xxx pulpcore-api: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Dec 16 07:34:12 xxx pulpcore-api: return view_func(*args, **kwargs)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/viewsets.py", line 125, in view
Dec 16 07:34:12 xxx pulpcore-api: return self.dispatch(request, *args, **kwargs)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 509, in dispatch
Dec 16 07:34:12 xxx pulpcore-api: response = self.handle_exception(exc)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 469, in handle_exception
Dec 16 07:34:12 xxx pulpcore-api: self.raise_uncaught_exception(exc)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
Dec 16 07:34:12 xxx pulpcore-api: raise exc
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 506, in dispatch
Dec 16 07:34:12 xxx pulpcore-api: response = handler(request, *args, **kwargs)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/mixins.py", line 43, in list
Dec 16 07:34:12 xxx pulpcore-api: return self.get_paginated_response(serializer.data)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 745, in data
Dec 16 07:34:12 xxx pulpcore-api: ret = super().data
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 246, in data
Dec 16 07:34:12 xxx pulpcore-api: self._data = self.to_representation(self.instance)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 664, in to_representation
Dec 16 07:34:12 xxx pulpcore-api: self.child.to_representation(item) for item in iterable
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 664, in <listcomp>
Dec 16 07:34:12 xxx pulpcore-api: self.child.to_representation(item) for item in iterable
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 515, in to_representation
Dec 16 07:34:12 xxx pulpcore-api: ret[field.field_name] = field.to_representation(attribute)
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/pulpcore/app/serializers/repository.py", line 360, in to_representation
Dec 16 07:34:12 xxx pulpcore-api: item_dict = {"count": count_detail.count, "href": count_detail.content_href}
Dec 16 07:34:12 xxx pulpcore-api: File "/usr/lib/python3.6/site-packages/pulpcore/app/models/repository.py", line 1027, in content_href
Dec 16 07:34:12 xxx pulpcore-api: ctype_model = Content.objects.filter(pulp_type=self.content_type).first().cast().__class__
Dec 16 07:34:12 xxx pulpcore-api: AttributeError: 'NoneType' object has no attribute 'cast'
Dec 16 07:34:12 xxx pulpcore-api: pulp [aaa-aaaaa-aaaaaa-aaaaaa-aaaaaaaa]:  - - [16/Dec/2021:06:34:12 +0000] "GET /pulp/api/v3/repositories/rpm/rpm/c6963cf8-4a81-4b18-94e9-651ec8a07319/versions/?limit=2000&offset=0 HTTP/1.1" 500 27 "-" "OpenAPI-Generator/3.13.3/ruby"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How reproducible:
In customer environment

Additional info:
Upstream link: https://pulp.plan.io/issues/9481

Comment 1 Dennis Kliban 2022-03-30 17:47:27 UTC
This is fixed in pulpcore 3.14, 3.15, 3.16, 3.17, 3.18 .

Comment 9 errata-xmlrpc 2022-07-05 14:31:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498


Note You need to log in before you can comment on or make changes to this bug.