mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
move mysql module to use new config.option function
This commit is contained in:
parent
ae5e5daca2
commit
464f3a2867
@ -42,12 +42,8 @@ def __virtual__():
|
||||
'''
|
||||
Only load this module if the mysql config is set
|
||||
'''
|
||||
if any(k.startswith('mysql.') for k in list(__opts__)):
|
||||
if has_mysqldb:
|
||||
return 'mysql'
|
||||
elif any(k.startswith('mysql.') for k in list(__pillar__)):
|
||||
if has_mysqldb:
|
||||
return 'mysql'
|
||||
if __salt__['config.dot_key']('mysql') and has_mysqldb:
|
||||
return 'mysql'
|
||||
return False
|
||||
|
||||
|
||||
@ -100,10 +96,8 @@ def connect(**kwargs):
|
||||
key = name
|
||||
if name in kwargs:
|
||||
connargs[key] = kwargs[name]
|
||||
elif 'mysql.{0}'.format(name) in __opts__:
|
||||
connargs[key] = __opts__['mysql.{0}'.format(name)]
|
||||
elif 'mysql.{0}'.format(name) in __pillar__:
|
||||
connargs[key] = __pillar__['mysql.{0}'.format(name)]
|
||||
else:
|
||||
connargs[key] = __salt__['config.option']('mysql.{0}'.format(name))
|
||||
|
||||
_connarg('host')
|
||||
_connarg('user')
|
||||
|
Loading…
Reference in New Issue
Block a user