Add virtual function to mysql, only load if it is configured

This commit is contained in:
Thomas S Hatch 2012-02-05 21:53:08 -07:00
parent d4f91959f9
commit b7e7cc3cb1

View File

@ -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