Skip to content

Commit

Permalink
Fix incorrect version argument will be ignored warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrx312 authored and dwoz committed May 13, 2024
1 parent e5eee2f commit 00f6d42
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/64563.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module.
4 changes: 2 additions & 2 deletions salt/modules/yumpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1427,8 +1427,8 @@ def install(
'version': '<new-version>',
'arch': '<new-arch>'}}}
"""
if "version" in kwargs:
kwargs["version"] = str(kwargs["version"])
if (version := kwargs.get("version")) is not None:
kwargs["version"] = str(version)
options = _get_options(**kwargs)

if salt.utils.data.is_true(refresh):
Expand Down
3 changes: 2 additions & 1 deletion tests/pytests/functional/states/test_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_pkg_002_installed_with_version(PKG_TARGETS, states, latest_version):

@pytest.mark.requires_salt_states("pkg.installed", "pkg.removed")
@pytest.mark.slow_test
def test_pkg_003_installed_multipkg(PKG_TARGETS, modules, states):
def test_pkg_003_installed_multipkg(caplog, PKG_TARGETS, modules, states):
"""
This is a destructive test as it installs and then removes two packages
"""
Expand All @@ -247,6 +247,7 @@ def test_pkg_003_installed_multipkg(PKG_TARGETS, modules, states):
try:
ret = states.pkg.installed(name=None, pkgs=PKG_TARGETS, refresh=False)
assert ret.result is True
assert "WARNING" not in caplog.text
finally:
ret = states.pkg.removed(name=None, pkgs=PKG_TARGETS)
assert ret.result is True
Expand Down

0 comments on commit 00f6d42

Please sign in to comment.