Actions
Issue #5445
closed"KeyError: 'relative_path'" in SingleArtifactContentSerializer
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:
Description
We're seeing this issue in pulp_ansible:
Traceback (most recent call last):
File "/home/travis/build/pulp/pulp_ansible/pulp_ansible/tests/unit/test_serializers.py", line 41, in test_duplicate_data
serializer = RoleSerializer(data=self.data, context={"view": view})
File "/home/travis/build/pulp/pulpcore/pulpcore/app/serializers/content.py", line 49, in __init__
self.fields["relative_path"].write_only = False
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rest_framework/utils/serializer_helpers.py", line 148, in __getitem__
return self.fields[key]
KeyError: 'relative_path'
The problem here[0] is that the Role model in pulp_ansible has a relative_path but it's not on the serializer.
Related issues
Updated by daviddavis about 5 years ago
- Status changed from ASSIGNED to POST
Updated by daviddavis about 5 years ago
- Related to Task #5428: Rename the fields "_relative_path" and "_artifact" on the SingleArtifactContentSerializer to "relative_path" and "artifact" respectively added
Added by daviddavis about 5 years ago
Updated by daviddavis about 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|9917c590a036d4c78124438a69f8f05057be0766.
Added by daviddavis about 5 years ago
Revision 648d8e51 | View on GitHub
Remove the relative_path if not on serializer fields
We also should pop the relative_path off validated_data if the serializer doesn't have the relative_path as a field.
Updated by daviddavis about 5 years ago
- Status changed from MODIFIED to ASSIGNED
Updated by daviddavis about 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|648d8e51f4f94c838a0da7a35fb0036fd6c42fd3.
Updated by bmbouter almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions
Ensure that relative_path is defined on the serializer
fixes #5445 https://pulp.plan.io/issues/5445