Repository navigation
Restore the zypperpkg exit code 104 fix on 3008.x (#69758) - #70584
Merged
Merged
Conversation
…ltstack#69758) zypper returns exit code 104 when a search matches nothing. The search-style calls in zypperpkg (search, _get_visible_patterns, _get_patches, and Wildcard._get_available_versions) run through cmd.run_all, whose default success_retcodes is [0], so the 104 was logged as a command failure even though the search itself completed normally and correctly reported that nothing was found. Add an ignore_not_found option to the _Zypper wrapper that whitelists 104 via success_retcodes for those search calls, so the exit code is treated as success and no ERROR is emitted. The found case (0) and all genuine error codes are left untouched. Fixes saltstack#58551 Restores saltstack#69758 on 3008.x. It was dropped by the 3007.x merge-forward saltstack#70132 and isn't in the saltstack#70572 restore (saltstack#70542). The 3008.3 release notes already have the changelog entry, so there is no new fragment. (cherry picked from commit a9aa0bd)
The mocked cmd.run_all returns 104 as-is, where the real one remaps it to 0, so _check_result treats it as an error and _is_rpm_lock opens /var/lib/rpm/.rpm.lock. Run as a normal user on an RPM-based host, the test fails with PermissionError. Patch _is_rpm_lock like the other non-zero retcode tests in this file.
dwoz
approved these changes
Oct 28, 2026
This branch was previously deployed
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 does this PR do?
Restores #69758 on 3008.x. The 3007.x merge-forward #70132 dropped it, and #70572 didn't bring it back (#70542). 3007.x has it; 3008.x and master don't, although the 3008.3 release notes list it.
The first commit is a9aa0bd cherry-picked as-is (same patch-id), so
salt/modules/zypperpkg.pymatches 3007.x again. The second makestest_search_not_found_58551patch_is_rpm_locklike the other non-zero retcode tests in the file. Without that it opens the host's/var/lib/rpm/.rpm.lockand fails withPermissionErrorwhen run as a normal user on an RPM-based host.What issues does this PR fix or reference?
Refs #58551, #69758, #70542
Previous Behavior
On 3008.x, when a zypper search matches nothing (exit code 104),
cmd.run_alllogsCommand '...' failed with return code: 104at ERROR.pkg.searchstill raises "No packages found matching", butpkg.list_patches,pkg.list_installed_patches,pkg.list_patterns,pkg.list_installed_patternsand version wildcards inpkg.installfail with "Zypper command failure: Check Zypper's logs."New Behavior
Same as 3006.x and 3007.x: those four search calls pass 104 as a success retcode, so nothing is logged at ERROR, the patch and pattern lists come back empty, and an unmatched version wildcard raises "No packages found matching ''". Other exit codes are handled as before.
Merge requirements satisfied?
No changelog fragment, since the 3008.3 release notes already list #58551.
tests/unit/modules/test_zypperpkg.py: 59 passed locally on Python 3.14. With 3008.x'szypperpkg.py, 9 fail (test_search,test_search_not_found_58551and 7test_wildcard_to_query_*tests). pylint and pre-commit are clean.Commits signed with GPG?
No