Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating mysql users via salt fails with traceback #255

Closed
darix opened this issue Aug 12, 2020 · 4 comments
Closed

Creating mysql users via salt fails with traceback #255

darix opened this issue Aug 12, 2020 · 4 comments

Comments

@darix
Copy link
Member

darix commented Aug 12, 2020

traceback

2020-08-12 17:29:42,897 [salt.state       :323 ][ERROR   ][32435] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/salt/state.py", line 1987, in call
    ret = self.states[cdata['full']](*cdata['args'], **cdata['kwargs'])
  File "/usr/lib/python3.6/site-packages/salt/loader.py", line 2031, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/salt/states/mysql_user.py", line 142, in present
    **connection_args):
  File "/usr/lib/python3.6/site-packages/salt/modules/mysql.py", line 1268, in user_exists
    server_version = salt.utils.data.decode(version(**connection_args))
  File "/usr/lib/python3.6/site-packages/salt/modules/mysql.py", line 860, in version
    dbc = _connect(**connection_args)
  File "/usr/lib/python3.6/site-packages/salt/modules/mysql.py", line 394, in _connect
    dbc = MySQLdb.connect(**connargs)
  File "/usr/lib64/python3.6/site-packages/MySQLdb/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib64/python3.6/site-packages/MySQLdb/connections.py", line 148, in __init__
    for k, v in conv.items():
AttributeError: 'str' object has no attribute 'items'

when logging connargs in /usr/lib/python3.6/site-packages/salt/modules/mysql.py

it is shown as 'conv': '' this does not match the API descriptions in the mysqlclient 1.4.6 (which is in 15.2 and TW), which requires conv to be a dictionary.

The culprit seems to be

val = __salt__['config.option']('mysql.{0}'.format(name), None)

which returns an empty string instead of None so the check below is not catching that case. when we extend the check below with

if val is not None and val != '':

then the state works as expected.

@meaksh
Copy link
Member

meaksh commented Aug 13, 2020

NOTE: This issue is fixed upstream in Salt 3000.1 by saltstack/salt#56174

@cryptomilk
Copy link

openSUSE 15.2 has 3000 where this is bug occurs:

# rpm -q salt-master
salt-master-3000-lp152.3.6.1.x86_64

@darix
Copy link
Member Author

darix commented Aug 13, 2020

NOTE: This issue is fixed upstream in Salt 3000.1 by saltstack/salt#56174

do we have an ETA for the upgrade already?

@meaksh
Copy link
Member

meaksh commented Aug 17, 2020

This is now fixed by 055abf0 and pushed to our Salt 3000 testing package with https://build.opensuse.org/request/show/827341

It will take still some time until it get released in OpenSUSE Leap 15.2, but you can already use the above testing package.

I'm closing this issue already. Thanks for reporting!

@meaksh meaksh closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants