Project

Profile

Help

Issue #5445

"KeyError: 'relative_path'" in SingleArtifactContentSerializer

Added by daviddavis 5 months ago. Updated about 1 month ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

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 here0 is that the Role model in pulp_ansible has a relative_path but it's not on the serializer.

[0] https://github.com/pulp/pulpcore/commit/342f4539c09a7accda7d2ffaaea7666b1dac0463#diff-550358b6baa6118249bdbcfa195fe88dR49


Related issues

Related to Pulp - Task #5428: Rename the fields "_relative_path" and "_artifact" on the SingleArtifactContentSerializer to "relative_path" and "artifact" respectively CLOSED - CURRENTRELEASE Actions

Associated revisions

Revision 9917c590 View on GitHub
Added by daviddavis 5 months ago

Ensure that relative_path is defined on the serializer

fixes #5445
https://pulp.plan.io/issues/5445

Revision 648d8e51 View on GitHub
Added by daviddavis 5 months ago

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.

fixes #5445
https://pulp.plan.io/issues/5445

History

#1 Updated by daviddavis 5 months ago

  • Status changed from ASSIGNED to POST

#2 Updated by daviddavis 5 months ago

  • Related to Task #5428: Rename the fields "_relative_path" and "_artifact" on the SingleArtifactContentSerializer to "relative_path" and "artifact" respectively added

#3 Updated by daviddavis 5 months ago

  • Status changed from POST to MODIFIED

#4 Updated by daviddavis 5 months ago

  • Status changed from MODIFIED to ASSIGNED

#5 Updated by daviddavis 5 months ago

  • Status changed from ASSIGNED to POST

#6 Updated by daviddavis 5 months ago

  • Status changed from POST to MODIFIED

#7 Updated by bmbouter about 1 month ago

  • Sprint/Milestone set to 3.0.0

#8 Updated by bmbouter about 1 month ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF