[Bug]: yumpkg.py - list_upgrades should also set get_extra_options like upgrade
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
What happened?
If one uses extra options for pkg.uptodate (like "exclude; kernel*" and uses state.test/test=true the excludes are not used by list_upgrades because _get_options has not get_extra_options=True set so test and result are different.
Solution: set get_extra_options=True when calling _get_options:
diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py
index 5d8d389a58..4366e0f78a 100644
--- a/salt/modules/yumpkg.py
+++ b/salt/modules/yumpkg.py
@@ -1023,13 +1023,17 @@ def list_upgrades(refresh=True, **kwargs):
.. versionadded:: 2014.7.0
Support for the ``disableexcludes`` option
+ .. note::
+ To add extra arguments to the ``yum list upgrades`` command, pass them as key
+ word arguments. For arguments without assignments, pass ``True``
+
CLI Example:
.. code-block:: bash
- salt '*' pkg.list_upgrades
+ salt '*' pkg.list_upgrades security=True exclude='kernel*'
"""
- options = _get_options(**kwargs)
+ options = _get_options(get_extra_options=True, **kwargs)
if salt.utils.data.is_true(refresh):
refresh_db(check_update=False, **kwargs)
Type of salt install
Official rpm
Major version
3006.x
What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)
rhel-10, rhel-9, rhel-8
salt --versions-report output
Salt Version:
Salt: 3006.23
Python Version:
Python: 3.10.19 (main, Feb 17 2026, 23:32:03) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: 18.10.0
cryptography: 46.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.6
libgit2: 1.7.2
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: 1.14.1
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.22.4
smmap: Not Installed
timelib: 0.3.0
Tornado: 4.5.3
ZMQ: 4.3.4
Salt Extensions:
saltext.vault: 1.3.0
System Versions:
dist: rhel 9.8 Plow
locale: utf-8
machine: x86_64
release: 5.14.0-687.30.1.el9_8.x86_64
system: Linux
version: Red Hat Enterprise Linux 9.8 Plow
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/modules/yumpkg.py at list_upgrades and trace how _get_options handles extra options compared with upgrade. Reproduce the difference using pkg.uptodate with exclude and test mode, then verify that list_upgrades honors the same options and that the documented keyword arguments match the resulting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100