salt: MySQL state and module broken after upgrade to 3000
Description of Issue
MySQL module can’t connect to MySQL socket.
Context
Debian 9 and MariaDB 10.4.
Module configuration:
mysql.default_file: '/etc/mysql/debian.cnf'
salt-minion 2019.2.3
~# salt-call mysql.version
local:
10.4.12-MariaDB-1:10.4.12+maria~stretch-log
salt-minion 3000
~# salt-call mysql.version
[ERROR ] An un-handled exception was caught by salt's global exception handler:
AttributeError: 'unicode' object has no attribute 'items'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
load_entry_point('salt==3000', 'console_scripts', 'salt-call')()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 445, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 57, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 119, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 218, in call
ret['return'] = self.minion.executors[fname](self.opts, data, func, args, kwargs)
File "/usr/lib/python2.7/dist-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/mysql.py", line 858, in version
dbc = _connect(**connection_args)
File "/usr/lib/python2.7/dist-packages/salt/modules/mysql.py", line 392, in _connect
dbc = MySQLdb.connect(**connargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 173, in __init__
for k, v in conv.items():
AttributeError: 'unicode' object has no attribute 'items'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
load_entry_point('salt==3000', 'console_scripts', 'salt-call')()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 445, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 57, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 119, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 218, in call
ret['return'] = self.minion.executors[fname](self.opts, data, func, args, kwargs)
File "/usr/lib/python2.7/dist-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/mysql.py", line 858, in version
dbc = _connect(**connection_args)
File "/usr/lib/python2.7/dist-packages/salt/modules/mysql.py", line 392, in _connect
dbc = MySQLdb.connect(**connargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 173, in __init__
for k, v in conv.items():
AttributeError: 'unicode' object has no attribute 'items'
Versions Report
Salt: 3000
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
M2Crypto: 0.24.0
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: 1.3.7
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.1
System Versions:
dist: debian 9.12
locale: UTF-8
machine: x86_64
release: 4.9.0-12-amd64
system: Linux
version: debian 9.12
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 26 (11 by maintainers)
Patch
patches/mysql.sls:
patches/files/3000-mysql.diff:
Run
sudo MINION state.apply patches.mysql
to apply the fix.@boltronics As a bonus, salt-version detecting and alerting to overrides would help when opening a ticket. Maybe I should open a new feature request.
I can confirm this also happens on CentOS 7. I can’t get any mysql modules or states to execute successfully.
sls
output:
I personally think an INFO message on startup would be good for anything in
_states
,_modules
, etc. that is acting as an override.