Skip to content

publish_pyxis_image: check if status_message key exists before use#979

Open
caxu-rh wants to merge 1 commit into
mainfrom
publish-pyxis-image-status-message
Open

publish_pyxis_image: check if status_message key exists before use#979
caxu-rh wants to merge 1 commit into
mainfrom
publish-pyxis-image-status-message

Conversation

@caxu-rh

@caxu-rh caxu-rh commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

In Pyxis, the image_request object may not always contain a status_message key (for example, if the request is still in state pending). Check for the existence of the key and use a fallback value N/A for the status message in logs, to avoid crashing while attempting to log and provide a neater error message.


Example pipeline run where the error was encountered: https://gist.github.com/rh-operator-bundle-bot/6c9441e0c4bcd790910d89ab64129b8e#file-operator-release-pipeline-run8f2b6-log-L469-L479

[publish-pyxis-data : publish-pyxis-image] Traceback (most recent call last):
[publish-pyxis-data : publish-pyxis-image]   File "/home/user/.venv/bin/publish-pyxis-image", line 6, in <module>
[publish-pyxis-data : publish-pyxis-image]     sys.exit(main())
[publish-pyxis-data : publish-pyxis-image]              ~~~~^^
[publish-pyxis-data : publish-pyxis-image]   File "/home/user/operatorcert/entrypoints/publish_pyxis_image.py", line 75, in main
[publish-pyxis-data : publish-pyxis-image]     submit_image_request(args)
[publish-pyxis-data : publish-pyxis-image]     ~~~~~~~~~~~~~~~~~~~~^^^^^^
[publish-pyxis-data : publish-pyxis-image]   File "/home/user/operatorcert/entrypoints/publish_pyxis_image.py", line 57, in submit_image_request
[publish-pyxis-data : publish-pyxis-image]     image_request["status_message"],
[publish-pyxis-data : publish-pyxis-image]     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
[publish-pyxis-data : publish-pyxis-image] KeyError: 'status_message'

Merge Request Checklists

  • Development is done in feature branches
  • Code changes are submitted as pull request into a primary branch [Provide reason for non-primary branch submissions]
  • Code changes are covered with unit and integration tests.
  • Code passes all automated code tests:
    • Linting
    • Code formatter - Black
    • Security scanners
    • Unit tests
    • Integration tests
  • Code is reviewed by at least 1 team member
  • Pull request is tagged with "risk/good-to-go" label for minor changes

In Pyxis, the image_request object may not always contain a
`status_message` key (for example, if the request is still in state
`pending`). Check for the existence of the key and use a fallback
value `N/A` for the status message in logs, to avoid crashing while
attempting to log and provide a neater error message.

Signed-off-by: Caleb Xu <caxu@redhat.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants