Skip to content

Fix pkg.installed ignoring allow_updates for sources installs - #69686

Merged
dwoz merged 3 commits into
saltstack:3006.xfrom
ggiesen:fix-35385-pkg-allow-updates-sources
Aug 7, 2026
Merged

dwoz merged 3 commits into
saltstack:3006.xfrom
ggiesen:fix-35385-pkg-allow-updates-sources

Conversation

@ggiesen

@ggiesen ggiesen commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

salt/states/pkg.py:814 computed allow_updates as bool(not sources and kwargs.get("allow_updates")), silently dropping the flag for any package installed via sources:, so _fulfills_version_string kept the exact-match "==" condition against the source package's version and self-updating agents got reinstalled/downgraded on every highstate. The fix removes the "not sources" guard so allow_updates converts the single "==" to ">=", leaving newer installed versions alone, and updates the installed() docstring to say allow_updates also covers sources installs. Verified the new unit test fails on the unpatched line and passes with the fix, both via the shadowed interpreter.

What issues does this PR fix or reference?

Fixes #35385

Previous Behavior

See #35385.

New Behavior

Fix pkg.installed ignoring allow_updates for sources installs. Validated by a unit test proven to fail on unpatched 3006.x and pass with the fix (confirmed by adversarial review).

Merge requirements satisfied?

  • Tests written/updated
  • Changelog

Commits signed with GPG?

No

_find_install_targets discarded the allow_updates flag whenever a package
came from sources: (allow_updates = bool(not sources and ...)), forcing an
exact-version match against the version reported by the source package. A
self-updating agent installed via sources would therefore be reinstalled or
downgraded on every highstate. Drop the 'not sources' guard so allow_updates
is honoured for sources installs, and document that behaviour.

Fixes saltstack#35385
…ow_updates

The direct test already existed in this branch and calls
_find_install_targets with sources and allow_updates=True, the exact kwarg
pkg.installed forwards (kwargs["allow_updates"] = allow_updates). This adds
the two inverse guards: with allow_updates left at its default of False a
newer installed version must still be targeted for downgrade to the source
package's version, and with allow_updates=True an older installed version
must still be targeted for upgrade, so the fix cannot silently widen into
ignoring version mismatches for sources installs.

Claude-Session: https://claude.ai/code/session_01MF2AuQNhBZg4HDt1x6xxCu
@dwoz dwoz added the test:full Run the full test suite label Jul 7, 2026
@charzl charzl self-assigned this Jul 10, 2026
@twangboy twangboy added this to the Sulphur v3006.28 milestone Jul 14, 2026
@dwoz
dwoz merged commit 10a6ec6 into saltstack:3006.x Aug 7, 2026
851 of 854 checks passed

This branch was previously deployed

1 inactive deployment
ci — add9d593 Deployed Jul 29, 2026 by ggiesen via Build Onedir Packages / RPM (arm64) #25936
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.

4 participants