mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add virtual function to mysql, only load if it is configured
This commit is contained in:
parent
d4f91959f9
commit
b7e7cc3cb1
@ -23,6 +23,15 @@ import MySQLdb.cursors
|
||||
log = logging.getLogger(__name__)
|
||||
__opts__ = {}
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Only load this module if the mysql config is set
|
||||
'''
|
||||
if 'mysql' in __opts__:
|
||||
return 'mysql'
|
||||
return False
|
||||
|
||||
|
||||
def __check_table(name, table):
|
||||
db = connect()
|
||||
cur = db.cursor(MySQLdb.cursors.DictCursor)
|
||||
@ -597,4 +606,5 @@ def grant_revoke(grant,
|
||||
if cur.execute( query ):
|
||||
log.info("Grant '{0}' revoked")
|
||||
return True
|
||||
return False
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user