Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] Fixed incorrect version argument will be ignored warning #66388

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading