Fix incorrect version argument will be ignored warning

This commit is contained in:
bdrx312 2024-04-29 03:33:37 -04:00 committed by Daniel Wozniak
parent 3bc6e3a01d
commit 378b1061e8
3 changed files with 5 additions and 3 deletions

1
changelog/64563.fixed.md Normal file
View file

@ -0,0 +1 @@
Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module.

View file

@ -1424,8 +1424,8 @@ def install(
'version': '<new-version>', 'version': '<new-version>',
'arch': '<new-arch>'}}} 'arch': '<new-arch>'}}}
""" """
if "version" in kwargs: if (version := kwargs.get("version")) is not None:
kwargs["version"] = str(kwargs["version"]) kwargs["version"] = str(version)
options = _get_options(**kwargs) options = _get_options(**kwargs)
if salt.utils.data.is_true(refresh): if salt.utils.data.is_true(refresh):

View file

@ -238,7 +238,7 @@ def test_pkg_002_installed_with_version(PKG_TARGETS, states, latest_version):
@pytest.mark.requires_salt_states("pkg.installed", "pkg.removed") @pytest.mark.requires_salt_states("pkg.installed", "pkg.removed")
@pytest.mark.slow_test @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 This is a destructive test as it installs and then removes two packages
""" """
@ -254,6 +254,7 @@ def test_pkg_003_installed_multipkg(PKG_TARGETS, modules, states):
try: try:
ret = states.pkg.installed(name=None, pkgs=PKG_TARGETS, refresh=False) ret = states.pkg.installed(name=None, pkgs=PKG_TARGETS, refresh=False)
assert ret.result is True assert ret.result is True
assert "WARNING" not in caplog.text
finally: finally:
ret = states.pkg.removed(name=None, pkgs=PKG_TARGETS) ret = states.pkg.removed(name=None, pkgs=PKG_TARGETS)
assert ret.result is True assert ret.result is True