fix: handle non-dict parsed JSON in firmware version manifest parser#1355
Merged
Merged
Conversation
parse_versioning kept the last json.loads-parseable line and then indexed it with a string key. When that line parsed to a non-dict (e.g. a JSON array), the index raised an uncaught TypeError because only KeyError was handled, aborting the task. Guard that the parsed value is a dict before indexing and fall through to the existing 'no JSON could be loaded' path otherwise. Adds a regression test covering the non-dict input case.
aad66bf to
2e08909
Compare
Contributor
Author
|
@michael-balint Gentle ping on this one when you have a moment — it's a small, self-contained robustness fix for |
michael-balint
approved these changes
Jul 2, 2026
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.
Summary
roles/nvidia-dgx-firmware/files/parse_manifest.pyparse_versioningkeeps the lastjson.loads-parseable line from the firmware container output, then indexes it with a string key (manifest_json['ErrorWritingVersioning']).TypeError. OnlyKeyErrorwas caught, so the exception escaped and aborted the task.dictbefore indexing; a non-dict now falls through to the existing "No JSON could be loaded" path and exits1cleanly instead of crashing.Validation
git diff --check origin/master...HEADpy_compileof the changed scriptTypeError) and confirmed the cleanexit 1after the fix.python -m unittest discover -s roles/nvidia-dgx-firmware/tests -v→Ran 1 test ... OKNotes