Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix traceback on retrieving role versions. #1945

Closed
wants to merge 2 commits into from

Conversation

jctanner
Copy link
Collaborator

@jctanner jctanner commented Oct 22, 2023

This is only showing up in the UI based on the Accept header using text/html ...

https://galaxy-dev.ansible.com/api/v1/roles/10984/versions/

curl -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' https://galaxy-dev.ansible.com/api/v1/roles/10984/versions/ 

<!doctype html>
<html lang="en">
<head>
  <title>Server Error (500)</title>
</head>
<body>
  <h1>Server Error (500)</h1><p></p>
</body>
</html>
2023-10-22 18:41:47,546 ERROR django.request: Internal Server Error: /api/v1/roles/10984/versions/
Traceback (most recent call last):
File "/venv/lib64/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/django/core/handlers/base.py", line 220, in _get_response
response = response.render()
^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/django/template/response.py", line 114, in render
self.content = self.rendered_content
^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/rest_framework/response.py", line 70, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/rest_framework/renderers.py", line 723, in render
context = self.get_context(data, accepted_media_type, renderer_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/rest_framework/renderers.py", line 701, in get_context
'filter_form': self.get_filter_form(data, view, request),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/rest_framework/renderers.py", line 629, in get_filter_form
queryset = view.get_queryset()
^^^^^^^^^^^^^^^^^^^
File "/venv/lib64/python3.11/site-packages/rest_framework/generics.py", line 63, in get_queryset
assert self.queryset is not None, (
^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'LegacyRoleVersionsViewSet' should either include a `queryset` attribute, or override the `get_queryset()` method.

No-Issue

Signed-off-by: James Tanner <[email protected]>
@github-actions github-actions bot added backport-4.2 This PR should be backported to stable-4.2 (1.2) backport-4.4 This PR should be backported to stable-4.4 (2.1) backport-4.5 This PR should be backported to stable-4.5 (2.2) backport-4.6 This PR should be backported to stable-4.6 (2.3) backport-4.7 This PR should be backported to stable-4.7 (2.4) backport-4.8 This PR should be backported to stable-4.8 (2.4) labels Oct 22, 2023
@jctanner jctanner removed backport-4.2 This PR should be backported to stable-4.2 (1.2) backport-4.4 This PR should be backported to stable-4.4 (2.1) backport-4.5 This PR should be backported to stable-4.5 (2.2) backport-4.6 This PR should be backported to stable-4.6 (2.3) backport-4.7 This PR should be backported to stable-4.7 (2.4) backport-4.8 This PR should be backported to stable-4.8 (2.4) labels Oct 22, 2023
No-Issue

Signed-off-by: James Tanner <[email protected]>
Copy link
Contributor

@jerabekjiri jerabekjiri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the queryset as part of #1915 (#1915/files#diff-51b9687beb36cfa3e3cbde3826715d6aaec50b35602059bbbb686f6255978f03R162), but forgot to add order_by, so LGTM 👍

@jctanner
Copy link
Collaborator Author

We don't need this anymore.

@jctanner jctanner closed this Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants