mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix pkg.latest for winrepo packages where the package is already up to date
This commit is contained in:
parent
fd0a725d7e
commit
da9e410c81
2 changed files with 23 additions and 1 deletions
|
@ -2789,7 +2789,8 @@ def latest(
|
|||
x
|
||||
for x in targets
|
||||
if not changes.get(x)
|
||||
or targets[x] not in changes[x].get("new").split(",")
|
||||
or changes[x].get("new") is not None
|
||||
and targets[x] not in changes[x].get("new").split(",")
|
||||
and targets[x] != "latest"
|
||||
]
|
||||
successful = [x for x in targets if x not in failed]
|
||||
|
|
|
@ -1196,3 +1196,24 @@ def test_latest_multiple_versions():
|
|||
with patch.dict(pkg.__salt__, salt_dict):
|
||||
ret = pkg.latest(pkg_name)
|
||||
assert ret.get("result", False) is True
|
||||
|
||||
|
||||
def test_latest_no_change_windows():
|
||||
"""
|
||||
Test pkg.latest with no change to the package version for winrepo packages
|
||||
|
||||
See: https://github.com/saltstack/salt/issues/65165
|
||||
"""
|
||||
pkg_name = "fake_pkg"
|
||||
version = "1.2.2"
|
||||
latest_version_mock = MagicMock(return_value={pkg_name: version})
|
||||
current_version_mock = MagicMock(return_value={pkg_name: version})
|
||||
install_mock = MagicMock(return_value={pkg_name: {"install status": "success"}})
|
||||
salt_dict = {
|
||||
"pkg.latest_version": latest_version_mock,
|
||||
"pkg.version": current_version_mock,
|
||||
"pkg.install": install_mock,
|
||||
}
|
||||
with patch.dict(pkg.__salt__, salt_dict):
|
||||
ret = pkg.latest(pkg_name)
|
||||
assert ret.get("result", False) is True
|
||||
|
|
Loading…
Add table
Reference in a new issue