Actions
Issue #9481
closedAttributeError: 'NoneType' object has no attribute 'cast' thrown when listing repostiory versions
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 107
Quarter:
Description
Ticket moved to GitHub: "pulp/pulpcore/2085":https://github.com/pulp/pulpcore/issues/2085
We've had two reports of this, one for debian and one for rpm:
https://community.theforeman.org/t/remove-orphans-task-fails-to-complete-4-1-3-4-2-0rc1/25448/2
Sep 30 17:11:21 xxx pulpcore-api[244250]: pulp [e9c240744ab9495589cb7b252f7f91df]: django.request:ERROR: Internal Server Error: /pulp/api/v3/repositories/rpm/rpm/8e8e0a36-93a5-4d38-b9be-cdfeee4cc951/versions/
Sep 30 17:11:21 xxx pulpcore-api[244250]: Traceback (most recent call last):
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
Sep 30 17:11:21 xxx pulpcore-api[244250]: response = get_response(request)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
Sep 30 17:11:21 xxx pulpcore-api[244250]: response = self.process_exception_by_middleware(e, request)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
Sep 30 17:11:21 xxx pulpcore-api[244250]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Sep 30 17:11:21 xxx pulpcore-api[244250]: return view_func(*args, **kwargs)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/viewsets.py", line 125, in view
Sep 30 17:11:21 xxx pulpcore-api[244250]: return self.dispatch(request, *args, **kwargs)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 509, in dispatch
Sep 30 17:11:21 xxx pulpcore-api[244250]: response = self.handle_exception(exc)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 469, in handle_exception
Sep 30 17:11:21 xxx pulpcore-api[244250]: self.raise_uncaught_exception(exc)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
Sep 30 17:11:21 xxx pulpcore-api[244250]: raise exc
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 506, in dispatch
Sep 30 17:11:21 xxx pulpcore-api[244250]: response = handler(request, *args, **kwargs)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/mixins.py", line 43, in list
Sep 30 17:11:21 xxx pulpcore-api[244250]: return self.get_paginated_response(serializer.data)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 745, in data
Sep 30 17:11:21 xxx pulpcore-api[244250]: ret = super().data
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 246, in data
Sep 30 17:11:21 xxx pulpcore-api[244250]: self._data = self.to_representation(self.instance)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 664, in to_representation
Sep 30 17:11:21 xxx pulpcore-api[244250]: self.child.to_representation(item) for item in iterable
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 664, in <listcomp>
Sep 30 17:11:21 xxx pulpcore-api[244250]: self.child.to_representation(item) for item in iterable
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 515, in to_representation
Sep 30 17:11:21 xxx pulpcore-api[244250]: ret[field.field_name] = field.to_representation(attribute)
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/pulpcore/app/serializers/repository.py", line 360, in to_representation
Sep 30 17:11:21 xxx pulpcore-api[244250]: item_dict = {"count": count_detail.count, "href": count_detail.content_href}
Sep 30 17:11:21 xxx pulpcore-api[244250]: File "/usr/lib/python3.6/site-packages/pulpcore/app/models/repository.py", line 1027, in content_href
Sep 30 17:11:21 xxx pulpcore-api[244250]: ctype_model = Content.objects.filter(pulp_type=self.content_type).first().cast().__class__
Sep 30 17:11:21 xxx pulpcore-api[244250]: AttributeError: 'NoneType' object has no attribute 'cast'
Sep 30 17:11:21 xxx pulpcore-api[244250]: pulp [e9c240744ab9495589cb7b252f7f91df]: - - [30/Sep/2021:15:11:21 +0000] "GET /pulp/api/v3/repositories/rpm/rpm/8e8e0a36-93a5-4d38-b9be-cdfeee4cc951/versions/?limit=2000&offset=0 HTTP/1.1" 500 27 "-" "OpenAPI-Generator/3.13.3/ruby"
Actions
Fix error when listing repo version while running orphan cleanup
fixes: #9481