salt: pkg version: latest are now broken, appending -latest to filename

Description of Issue/Question

I’m trying to use a very simple state:

sl:
  pkg.installed:
    - version: latest

This does not work on Red Hat 6 but it works perfectly fine on Ubuntu 16.04

The minion tries to install package sl-latest instead of the latest version of sl

[user@hostname ~]$ salt-call -ldebug state.sls sl
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Connecting to master. Attempt 1 of 1
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (2725)
[DEBUG   ] Setting zmq_reconnect_ivl to '2725ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506', 'clear')
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_b7a7406eda_pub.ipc
[DEBUG   ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_b7a7406eda_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_b7a7406eda_pull.ipc
[DEBUG   ] Sending event: tag = salt/auth/creds; data = {'_stamp': '2017-07-07T08:00:33.968705', 'creds': {'publish_port': 4505, 'aes': '###REDACTED###', 'master_uri': 'tcp://salt:4506'}, 'key': ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506')}
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Determining pillar cache
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506')
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.sls
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506')
[DEBUG   ] Determining pillar cache
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506')
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] In saltenv 'base', looking at rel_path 'sl.sls' to resolve 'salt://sl.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/sl.sls' to resolve 'salt://sl.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/sl.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/sl.sls' using 'jinja' renderer: 0.00310182571411
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/sl.sls:
sl:
  pkg.installed:
    - version: latest

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering:
OrderedDict([('sl', OrderedDict([('pkg.installed', [OrderedDict([('version', 'latest')])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/sl.sls' using 'yaml' renderer: 0.0039541721344
[DEBUG   ] LazyLoaded pkg.install
[DEBUG   ] LazyLoaded pkg.installed
[DEBUG   ] LazyLoaded boto.assign_funcs
[DEBUG   ] Module PSGet: Only available on Windows systems
[DEBUG   ] boto_kms requires boto 2.38.0.
[DEBUG   ] You should upgrade pyOpenSSL to at least 0.14.1 to enable the use of X509 extensions in the tls module
[DEBUG   ] Module DSC: Only available on Windows systems
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
[INFO    ] Running state [sl] at time 04:00:35.631905
[INFO    ] Executing state pkg.installed for sl
[INFO    ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.check_db: 'pkg.check_db' is not available.
[INFO    ] Executing command ['yum', '--quiet', 'clean', 'expire-cache'] in directory '/root'
[DEBUG   ] output:
[INFO    ] Executing command ['yum', '--quiet', 'check-update'] in directory '/root'
[INFO    ] Executing command ['yum', '--quiet', 'list', 'available', 'sl'] in directory '/root'
[DEBUG   ] Failed to get holds, versionlock plugin is probably not installed
[INFO    ] Executing command ['yum', '-y', 'install', 'sl-latest'] in directory '/root'
[ERROR   ] Command '['yum', '-y', 'install', 'sl-latest']' failed with return code: 1
[ERROR   ] stdout: Loaded plugins: amazon-id, rhui-lb, security
Setting up Install Process
No package sl-latest available.
Error: Nothing to do
[ERROR   ] retcode: 1
[INFO    ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[ERROR   ] Error occurred installing package(s). Additional info follows:

errors:
    - Loaded plugins: amazon-id, rhui-lb, security
      Setting up Install Process
      No package sl-latest available.
      Error: Nothing to do
[INFO    ] Completed state [sl] at time 04:00:44.238699 duration_in_ms=8606.794
[DEBUG   ] File /var/cache/salt/minion/accumulator/37080592 does not exist, no need to cleanup.
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'hostname', 'tcp://salt:4506')
[DEBUG   ] LazyLoaded highstate.output

The same state works perfectly fine on Ubuntu 16.04 where the latest sl package was installed. Using Ubuntu it did not add -latest to the filename.

Steps to Reproduce Issue

Install Red Hat 6 Run the following state:

sl:
  pkg.installed:
    - version: latest

Versions Report

Master

Salt Version:
           Salt: 2016.11.5

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.0
      docker-py: 2.2.1
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
        machine: x86_64
        release: 4.4.0-1020-aws
         system: Linux
        version: Ubuntu 16.04 xenial

Red Hat minion

Salt Version:
           Salt: 2016.11.6

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.20.2
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3c1
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, May 22 2015, 08:34:51)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: redhat 6.7 Santiago
        machine: x86_64
        release: 2.6.32-573.el6.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 6.7 Santiago

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 16 (11 by maintainers)

Most upvoted comments

We have been using “latest” for some time now, probably 6 month as I recall.

We have our entire production environment depending on this since we are using pillar data to control versions but as default we are using “latest” if the pillar data is unset.

@terminalmage, I agree the work around is “easy”, but we have very many states depending on this logic so I’m afraid this work around are useless.

Our salt environment are currently broken

I can concur what @idokaplan is saying. We’ve been using “latest” for quite a while now, this is definitely not something new. From the documentation of 2016.3.2, pkg.installed: “If the version given is the string latest, the latest available package version will be installed à la pkg.latest.”

This bug broke major parts of our configuration environments, and is definitely critical.