Fix install_distro_packages() to return True when packages already installed#6298
Fix install_distro_packages() to return True when packages already installed#6298disgoel wants to merge 1 commit intoavocado-framework:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the install_distro_packages function in avocado/utils/software_manager/distro_packages.py to return True if all required packages are already present, rather than only when new packages are installed. It also adds a log message to indicate when no installation is necessary. I have no feedback to provide as there were no review comments to evaluate.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6298 +/- ##
==========================================
- Coverage 72.31% 72.30% -0.01%
==========================================
Files 206 206
Lines 23258 23260 +2
==========================================
Hits 16818 16818
- Misses 6440 6442 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
LGTM. I tested this locally -- install_distro_packages() returns False when everything's already installed, which makes ensure_tool() blow up with a RuntimeError even though the packages are there. The fix handles it correctly.
Just a heads up, the RTD CI failure isn't from your change -- it's a pre-existing docstring issue on master from #6274 the fix for that has been merged. Could you please do a rebase and then this one should be good to go :)
…stalled The function was returning False when all required packages were already installed, which caused ensure_tool() to incorrectly raise RuntimeError. This fix ensures the function returns True when packages are available, regardless of whether they were just installed or already present. Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
d1b3c21 to
f0863b7
Compare
Thanks for the review. I have rebased the code and sent again. |
Problem
The
install_distro_packages()function returnsFalsewhen all required packages are already installed. This causesensure_tool()(introduced in #6272) to incorrectly raise aRuntimeError, even though the packages are available.Root Cause
The function initializes
result = Falseand only sets it to True whensoftware_manager.install()is called. When all packages are already installed, the installation block is skipped, leaving result as False.This bug was exposed when testing avocado-misc-tests PR #3087, which uses ensure_tool() on systems where packages are already installed. The tests fail with
RuntimeError: Failed to install packages for perfeven though perf is installed and functional.