Skip to content

[Bug]: pkg.installed warnings if python rpm module not installed #68341

@bdrx312

Description

@bdrx312

What happened?

On rpm based systems, if the python rpm module is not installed then salt prints the warning [WARNING ] Please install a package that provides rpm.labelCompare for more accurate version comparisons. If the rpmdevtools is installed then another warning is also printed [WARNING ] Installing the rpmdevtools package may surface dev tools in production., and the version comparisons are done by a slow process fork to the rpmdev-vercmp executable for every comparison.

Steps to Reproduce the behavior

cat /srv/salt/testing.sls <<'EOF'
pkg1:
  pkg.installed:
    - pkgs:
      - hyphen: '2.8.8'
EOF
salt-call --local state.apply testing
$ sudo salt-call --local state.apply
[WARNING ] Please install a package that provides rpm.labelCompare for more accurate version comparisons.
[WARNING ] Installing the rpmdevtools package may surface dev tools in production.
[WARNING ] Please install a package that provides rpm.labelCompare for more accurate version comparisons.
[WARNING ] Installing the rpmdevtools package may surface dev tools in production.
local:
----------
          ID: pkg1
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed and are at the desired version
     Started: 20:35:03.742366
    Duration: 1274.975 ms
     Changes:

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:   1.275 s

Expected behavior

There should be no warnings when using pkg.installed state and should not fallback to slow process forking for comparison.

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)

rockylinux-9, rockylinux-10, rhel-8, rhel-9

salt --versions-report output

Salt Version:
          Salt: 3006.15

Python Version:
        Python: 3.10.18 (main, Aug 27 2025, 22:35:38) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.10.0
  cryptography: 42.0.5
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: Not Installed
  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: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.20.5
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: rocky 10.0 Red Quartz
        locale: utf-8
       machine: x86_64
       release: 6.12.0-55.32.1.el10_0.x86_64
        system: Linux
       version: Rocky Linux 10.0 Red Quartz

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