RedHatInsights / insights-core

Insights Core is a data collection and processing framework used by Red Hat Insights
https://cloud.redhat.com/insights
Apache License 2.0
153 stars 183 forks source link

fix: debug print of egg versions doesn't handle corrupted eggs #4101

Closed grunwmar closed 5 months ago

grunwmar commented 6 months ago

New if-else statement is added to check if exit code of previous Popen call is == 0 . Statement is added to insights.client.utilities.print_egg_version method.

CARD ID: CCT-406

All Pull Requests:

Check all that apply:

Complete Description of Additions/Changes:

Originally, when unimportable egg was encountered, Insights client logged part of the traceback to the DEBUG log. I added a functionality which checks exit code of corresponding subprocess calling import and egg and if the code is not == 0, then it results to message ""path/to/egg: Corrupted egg." I was not able to capture exception from subprocess, so I choose this approach by using exit status. There is space for discussion whether there could happen another scenarios other than unimportable corrupted egg. Non-existing egg is already handled in code before.

DuckBoss commented 5 months ago

@xiangce this LGTM after recent rebase and my testing, can you merge this?

m-horky commented 5 months ago

@Glutexo Please report that as a Jira ticket if it needs solving, we don't monitor closed PRs.

Glutexo commented 5 months ago

Yet, you noticed! 😎