salt: pkg.installed compares version including package epoch (pkg.version problem?)

The repoquery format salt uses for pkg.version is '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n', and this gets translated through salt into a format that means some pkg.version responses are: 1:1.0.1e-51.el7_2.4 and others are 1.0.1e-42.el6_7.2

I’m sure this is, on it’s own, undesired, since it makes version comparison unexpectedly difficult given the format changes (should perhaps always have a leading zero or a separator at least)

However, it seems that when using the pkg.installed state with a specific version, the pkg.version that salt uses in the comparison is the format with the leading epoch value. This results in comparison failing.

Something like:

kernel-devel:
  pkg.installed:
    - name: kernel-devel
    - version: 3.10.0-329.7.2.lve1.4.4.el7

Will fail the comparison, and rather than recognise that the package is already installed, it will instead try (in this case) to downgrade it:

[DEBUG   ] Current version (['1:3.10.0-329.7.2.lve1.4.4.el7']) did not match desired version specification (3.10.0-329.7.2.lve1.4.4.el7), adding to installation targets

Versions:

# salt-minion --versions
Salt Version:
           Salt: 2015.8.7

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: redhat 7.2 Valeri Kubasov
        machine: x86_64
        release: 3.10.0-329.7.2.lve1.4.4.el7.x86_64
         system: CloudLinux 7.2 Valeri Kubasov

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (21 by maintainers)

Commits related to this issue

Most upvoted comments

Correct!