Project

Profile

Help

Issue #5445

closed

"KeyError: 'relative_path'" in SingleArtifactContentSerializer

Added by daviddavis about 5 years ago. Updated almost 5 years ago.

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

[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" respectivelyCLOSED - CURRENTRELEASEmdellweg

Actions
Actions #1

Updated by daviddavis about 5 years ago

  • Status changed from ASSIGNED to POST
Actions #2

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

Revision 9917c590 | View on GitHub

Ensure that relative_path is defined on the serializer

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

Actions #3

Updated by daviddavis about 5 years ago

  • Status changed from POST to MODIFIED

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.

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

Actions #4

Updated by daviddavis about 5 years ago

  • Status changed from MODIFIED to ASSIGNED
Actions #5

Updated by daviddavis about 5 years ago

  • Status changed from ASSIGNED to POST
Actions #6

Updated by daviddavis about 5 years ago

  • Status changed from POST to MODIFIED
Actions #7

Updated by bmbouter almost 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #8

Updated by bmbouter almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF