salt: version param in pkg.installed broken in 2016.11.8/2017.7.2 in EL6-7

Description of Issue/Question

Broke in 2016.11.8 and 2017.7.2.

TypeError: expected string or buffer is because the value of name is None, so it breaks when the code tries to re.match('kernel(-.+)?', name)

Setup

/srv/salt/test.sls
teststate:
 pkg.installed:
  - name: audit
  - version: '2.4'

Or version: '2.4*'

Steps to Reproduce Issue

$ salt-call state.sls test
...
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/test.sls:

teststate:
 pkg.installed:
  - name: audit
  - version: '2.4'

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering:
OrderedDict([('teststate', OrderedDict([('pkg.installed', [OrderedDict([('name', 'audit')]), OrderedDict([('version', '2.4')])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/test.sls' using 'yaml' renderer: 0.0135700702667
[DEBUG   ] LazyLoaded pkg.install
[DEBUG   ] LazyLoaded pkg.installed
[DEBUG   ] Module PSGet: Only available on Windows systems
[DEBUG   ] You should upgrade pyOpenSSL to at least 0.14.1 to enable the use of X509 extensions in the tls module
[ERROR   ] org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[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 [audit] at time 12:14:07.391194
[INFO    ] Executing state pkg.installed for audit
[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.
[DEBUG   ] Could not LazyLoad pkg.check_extra_requirements: 'pkg.check_extra_requirements' is not available.
[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[DEBUG   ] Current version (['2.4.5-3.el6']) did not match desired version specification (2.4), adding to installation targets
[INFO    ] Executing command ['yum', '--quiet', 'clean', 'expire-cache'] in directory '/root'
[DEBUG   ] output:
[INFO    ] Executing command ['yum', '--quiet', 'check-update'] in directory '/root'
[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/salt/state.py", line 1765, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.6/site-packages/salt/loader.py", line 1705, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/salt/states/pkg.py", line 1440, in installed
    **kwargs)
  File "/usr/lib/python2.6/site-packages/salt/modules/yumpkg.py", line 1233, in install
    if re.match('kernel(-.+)?', name):
  File "/usr/lib64/python2.6/re.py", line 137, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or buffer

[INFO    ] Completed state [audit] at time 12:14:10.939263 duration_in_ms=3548.069
[DEBUG   ] File /var/cache/salt/minion/accumulator/55363600 does not exist, no need to cleanup.
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'redhat6-8.local', 'tcp://192.168.11.10:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'redhat6-8.local', 'tcp://192.168.11.10:4506')
[DEBUG   ] LazyLoaded highstate.output
local:
----------
          ID: teststate
    Function: pkg.installed
        Name: audit
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.6/site-packages/salt/state.py", line 1765, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.6/site-packages/salt/loader.py", line 1705, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.6/site-packages/salt/states/pkg.py", line 1440, in installed
                  **kwargs)
                File "/usr/lib/python2.6/site-packages/salt/modules/yumpkg.py", line 1233, in install
                  if re.match('kernel(-.+)?', name):
                File "/usr/lib64/python2.6/re.py", line 137, in match
                  return _compile(pattern, flags).match(string)
              TypeError: expected string or buffer
     Started: 12:14:07.391194
    Duration: 3548.069 ms
     Changes:

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

Versions Report

Broken for CentOS/RedHat 6/7

Salt Version:
           Salt: 2016.11.8

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.4.1
      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: Not Installed
      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.8 Santiago
        machine: x86_64
        release: 2.6.32-642.el6.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 6.8 Santiago
``

About this issue

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

Most upvoted comments

Thank you for updating this issue. It is no longer marked as stale.

This was fixed in 2016.11.9 and 2017.7.3 via https://github.com/saltstack/salt/pull/44188.

@saltstack/team-core It can be closed.