Project

Profile

Help

Issue #9481

closed

AttributeError: 'NoneType' object has no attribute 'cast' thrown when listing repostiory versions

Added by jsherril@redhat.com about 3 years ago. Updated almost 3 years ago.

Status:
CLOSED - DUPLICATE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
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

https://community.theforeman.org/t/pulpdebclient-apierror-http-500-when-running-katello-delete-orphaned-content/25468/4

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 #1

Updated by dkliban@redhat.com about 3 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 106
Actions #2

Updated by rchan about 3 years ago

  • Sprint changed from Sprint 106 to Sprint 107
Actions #3

Updated by gerrod about 3 years ago

  • Assignee set to gerrod
Actions #4

Updated by pulpbot about 3 years ago

  • Status changed from NEW to POST

Added by gerrod about 3 years ago

Revision 62670dc1 | View on GitHub

Fix error when listing repo version while running orphan cleanup

fixes: #9481

Actions #5

Updated by gerrod about 3 years ago

  • Status changed from POST to MODIFIED
Actions #6

Updated by pulpbot about 3 years ago

  • Sprint/Milestone set to 3.17.0
Actions #7

Updated by pulpbot about 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions #9

Updated by gerrod about 3 years ago

  • Status changed from CLOSED - CURRENTRELEASE to ASSIGNED
  • Sprint/Milestone deleted (3.17.0)

Re-opening as I figured out the real root of the issue. (Although the previous fix did prevent a theoretical issue that could have affected Katello in the future).

Actions #10

Updated by pulpbot about 3 years ago

  • Status changed from ASSIGNED to POST

Added by gerrod almost 3 years ago

Revision d767beb1 | View on GitHub

Fix repository version listing after version deletion

fixes: #9481 fixes: #8798

Actions #11

Updated by gerrod almost 3 years ago

  • Status changed from POST to MODIFIED
Actions #12

Updated by fao89 almost 3 years ago

  • Description updated (diff)
  • Status changed from MODIFIED to CLOSED - DUPLICATE

Also available in: Atom PDF