Skip to content

[Bug]: yumpkg.py - list_upgrades should also set get_extra_options like upgrade #70235

Open

Description

@uwerler

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions