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

Collection Detail Api - Add Deprecated info #1169

Merged

Conversation

MilanPospisil
Copy link
Contributor

https://issues.redhat.com/browse/AAH-1025

Current serializer for Collection detail lacks information about deprecation. This PR adds it.

Copy link
Member

@rochacbruno rochacbruno left a comment

Choose a reason for hiding this comment

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

Commit need to be signed

@rochacbruno
Copy link
Member

@MilanPospisil is it needed on previous versions to backport?

@MilanPospisil
Copy link
Contributor Author

MilanPospisil commented Mar 16, 2022

@MilanPospisil is it needed on previous versions to backport?

No, I dont have any info about backport. Thanks Bruno, I dont have merge rights, can you merge it please @rochacbruno ?

@rochacbruno rochacbruno merged commit 6ce0f25 into ansible:master Mar 18, 2022
@himdel
Copy link
Collaborator

himdel commented Mar 21, 2022

@MilanPospisil remember how I wasn't sure this won't break the other use of the same serializer - from CollectionVersionViewSet? :)

Well, looks like it does:

api_1          | Internal Server Error: /api/automation-hub/_ui/v1/repo/published/ansible/network/
api_1          | Traceback (most recent call last):
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 457, in get_attribute
api_1          |     return get_attribute(instance, self.source_attrs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 97, in get_attribute
api_1          |     instance = getattr(instance, attr)
api_1          | AttributeError: 'CollectionVersion' object has no attribute 'deprecated'
api_1          | 
api_1          | During handling of the above exception, another exception occurred:
api_1          | 
api_1          | Traceback (most recent call last):
api_1          |   File "/venv/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
api_1          |     response = get_response(request)
api_1          |   File "/venv/lib64/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
api_1          |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
api_1          |     return view_func(*args, **kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
api_1          |     return self.dispatch(request, *args, **kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
api_1          |     response = self.handle_exception(exc)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
api_1          |     self.raise_uncaught_exception(exc)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
api_1          |     raise exc
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
api_1          |     response = handler(request, *args, **kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/mixins.py", line 56, in retrieve
api_1          |     return Response(serializer.data)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 555, in data
api_1          |     ret = super().data
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 253, in data
api_1          |     self._data = self.to_representation(self.instance)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 522, in to_representation
api_1          |     ret[field.field_name] = field.to_representation(attribute)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 1886, in to_representation
api_1          |     return method(value)
api_1          |   File "/src/galaxy_ng/galaxy_ng/app/api/ui/serializers/collection.py", line 142, in get_latest_version
api_1          |     return CollectionVersionDetailSerializer(obj).data
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 555, in data
api_1          |     ret = super().data
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 253, in data
api_1          |     self._data = self.to_representation(self.instance)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 509, in to_representation
api_1          |     attribute = field.get_attribute(instance)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 490, in get_attribute
api_1          |     raise type(exc)(msg)
api_1          | AttributeError: Got AttributeError when attempting to get a value for field `deprecated` on serializer `CollectionVersionDetailSerializer`.
api_1          | The serializer field might be named incorrectly and not match any attribute or key on the `CollectionVersion` instance.
api_1          | Original exception text was: 'CollectionVersion' object has no attribute 'deprecated'.
api_1          | pulp [None]: django.request:ERROR: Internal Server Error: /api/automation-hub/_ui/v1/repo/published/ansible/network/
api_1          | Traceback (most recent call last):
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 457, in get_attribute
api_1          |     return get_attribute(instance, self.source_attrs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 97, in get_attribute
api_1          |     instance = getattr(instance, attr)
api_1          | AttributeError: 'CollectionVersion' object has no attribute 'deprecated'
api_1          | 
api_1          | During handling of the above exception, another exception occurred:
api_1          | 
api_1          | Traceback (most recent call last):
api_1          |   File "/venv/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
api_1          |     response = get_response(request)
api_1          |   File "/venv/lib64/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
api_1          |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
api_1          |     return view_func(*args, **kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
api_1          |     return self.dispatch(request, *args, **kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
api_1          |     response = self.handle_exception(exc)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
api_1          |     self.raise_uncaught_exception(exc)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
api_1          |     raise exc
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
api_1          |     response = handler(request, *args, **kwargs)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/mixins.py", line 56, in retrieve
api_1          |     return Response(serializer.data)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 555, in data
api_1          |     ret = super().data
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 253, in data
api_1          |     self._data = self.to_representation(self.instance)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 522, in to_representation
api_1          |     ret[field.field_name] = field.to_representation(attribute)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 1886, in to_representation
api_1          |     return method(value)
api_1          |   File "/src/galaxy_ng/galaxy_ng/app/api/ui/serializers/collection.py", line 142, in get_latest_version
api_1          |     return CollectionVersionDetailSerializer(obj).data
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 555, in data
api_1          |     ret = super().data
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 253, in data
api_1          |     self._data = self.to_representation(self.instance)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/serializers.py", line 509, in to_representation
api_1          |     attribute = field.get_attribute(instance)
api_1          |   File "/venv/lib64/python3.8/site-packages/rest_framework/fields.py", line 490, in get_attribute
api_1          |     raise type(exc)(msg)
api_1          | AttributeError: Got AttributeError when attempting to get a value for field `deprecated` on serializer `CollectionVersionDetailSerializer`.
api_1          | The serializer field might be named incorrectly and not match any attribute or key on the `CollectionVersion` instance.
api_1          | Original exception text was: 'CollectionVersion' object has no attribute 'deprecated'.

Can you look into fixing that please, or should I?

awcrosby added a commit to awcrosby/galaxy_ng that referenced this pull request Mar 28, 2022
awcrosby added a commit to awcrosby/galaxy_ng that referenced this pull request Mar 28, 2022
awcrosby added a commit to awcrosby/galaxy_ng that referenced this pull request Mar 28, 2022
This reverts commit 6ce0f25.

Above commit was related to AAH-1025

No-Issue
awcrosby added a commit to awcrosby/galaxy_ng that referenced this pull request Mar 28, 2022
This reverts commit 6ce0f25.

Above commit was related to AAH-1025

No-Issue
awcrosby added a commit that referenced this pull request Mar 28, 2022
This reverts commit 6ce0f25.

Above commit was related to AAH-1025

No-Issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants