Fix content list parsing when Pulp returns a bare JSON array from /api/v3/content/#90
Merged
jajreidy merged 1 commit intokonflux-ci:mainfrom Mar 26, 2026
Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #90 +/- ##
==========================================
+ Coverage 95.53% 97.01% +1.47%
==========================================
Files 70 74 +4
Lines 3946 5352 +1406
==========================================
+ Hits 3770 5192 +1422
+ Misses 176 160 -16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pulp’s generic content list endpoint can return either a paginated body
{"results": [...]}or a bare JSON array. The client assumed a dict and usedresp["results"], which raisedTypeError: list indices must be integers or slices, not stron the href fallback path (after an emptybuild_idquery) and could affect_find_artifact_contentthe same way.Why
Upload/result gathering failed in production when the href query returned a list-shaped body, so content was never found even though the API had responded with data.
How
Added
content_find_results_from_json()inpulp_tool/utils/response_utils.pyto normalize both shapes to a list of dicts.gather_content_data()inpulp_client.pyuses it for the build-id and href queries;_find_artifact_content()inupload_service.pyuses it for href lookups. Tests cover the helper, href fallback with list JSON, and_find_artifact_contentwith list JSON.How to test
Notes for reviewers
pulp_client.py,upload_service.py,response_utils.py, plus tests).make test-diff-coverage.Files touched (vs
origin/main)pulp_tool/api/pulp_client.py,pulp_tool/services/upload_service.py,pulp_tool/utils/response_utils.py,tests/api/test_pulp_client.py,tests/test_upload.py,tests/utils/test_response_utils.py,CHANGELOG.md.