Skip to content

Restore the zypperpkg exit code 104 fix on 3008.x (#69758) - #70584

Merged
dwoz merged 2 commits into
saltstack:3008.xfrom
ggiesen:restore-69758-zypper-104
Oct 28, 2026
Merged

dwoz merged 2 commits into
saltstack:3008.xfrom
ggiesen:restore-69758-zypper-104

Conversation

@ggiesen

@ggiesen ggiesen commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

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.py matches 3007.x again. The second makes test_search_not_found_58551 patch _is_rpm_lock like the other non-zero retcode tests in the file. Without that it opens the host's /var/lib/rpm/.rpm.lock and fails with PermissionError when 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_all logs Command '...' failed with return code: 104 at ERROR. pkg.search still raises "No packages found matching", but pkg.list_patches, pkg.list_installed_patches, pkg.list_patterns, pkg.list_installed_patterns and version wildcards in pkg.install fail 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?

  • Docs
  • Changelog
  • Tests written/updated

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's zypperpkg.py, 9 fail (test_search, test_search_not_found_58551 and 7 test_wildcard_to_query_* tests). pylint and pre-commit are clean.

Commits signed with GPG?

No

ggiesen and others added 2 commits October 28, 2026 02:05
…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.
@ggiesen
ggiesen requested a review from a team as a code owner October 28, 2026 02:23
@dwoz dwoz added the test:full Run the full test suite label Oct 28, 2026

This branch was previously deployed

1 inactive deployment
ci — dc6fb9e3 Deployed Oct 28, 2026 by dwoz via Build Onedir Packages / RPM (x86_64) #27966
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants