Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:saltstack/salt into hotfix/pylin…
Browse files Browse the repository at this point in the history
…t/C0103
  • Loading branch information
s0undt3ch committed Dec 28, 2012
2 parents 2a5dcab + 5ee5a11 commit 0133d7e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 21 deletions.
22 changes: 22 additions & 0 deletions salt/modules/gentoolkit.py
@@ -0,0 +1,22 @@
'''
Support for Gentoolkit
'''

def revdep_rebuild(lib=None):
'''
Fix up broken reverse dependencies
lib
Search for reverse dependencies for a particular library rather
than every library on the system. It can be a full path to a
library or basic regular expression.
CLI Example::
salt '*' gentoolkit.revdep_rebuild
'''
cmd = 'revdep-rebuild --quiet --no-progress'
if lib is not None:
cmd += ' --library={0}'.format(lib)
return __salt__['cmd.retcode'](cmd) == 0
42 changes: 21 additions & 21 deletions salt/modules/mysql.py
Expand Up @@ -783,8 +783,8 @@ def grant_revoke(grant,

def processlist():
'''
Retrieves the processlist from the MySQL server via
"SHOW FULL PROCESSLIST".
Retrieves the processlist from the MySQL server via
"SHOW FULL PROCESSLIST".
Returns: a list of dicts, with each dict representing a process:
{'Command': 'Query',
Expand All @@ -801,18 +801,18 @@ def processlist():
CLI Example:
salt '*' mysql.processlist
'''
ret = []
hdr=("Id", "User", "Host", "db", "Command","Time", "State",
ret = []
hdr=("Id", "User", "Host", "db", "Command","Time", "State",
"Info", "Rows_sent", "Rows_examined", "Rows_read")

log.debug('processlist')
log.debug('MySQL Process List:\n{0}'.format(processlist()))
db = connect()
cur = db.cursor()
cur.execute("SHOW FULL PROCESSLIST")
for i in range(cur.rowcount):
row = cur.fetchone()
row = cur.fetchone()
r = {}
for j in range(len(hdr)):
try:
Expand All @@ -821,13 +821,13 @@ def processlist():
pass

ret.append(r)

cur.close()
return ret
def __do_query_into_hash(conn, sqlStr):
'''
Perform the query that is passed to it (sqlStr).
Returns:
results in a dict.
Expand All @@ -839,25 +839,25 @@ def __do_query_into_hash(conn, sqlStr):

try:
cursor = conn.cursor()
except Exception:
self.__log.error("%s: Can't get cursor for SQL->%s" % (mod, sqlStr))
except MySQLdb.MySQLError:
log.error("%s: Can't get cursor for SQL->%s" % (mod, sqlStr))
cursor.close()
log.debug(('%s-->' % mod))
log.debug(('%s-->' % mod))
return rtnResults

try:
rs = cursor.execute(sqlStr)
except Exception:
except MySQLdb.MySQLError:
log.error("%s: try to execute : SQL->%s" % (mod, sqlStr))
cursor.close()
log.debug(('%s-->' % mod))
log.debug(('%s-->' % mod))
return rtnResults

rs = cursor.fetchall()

for rowData in rs:
colCnt = 0
row = {}
row = {}
for colData in cursor.description:
colName = colData[0]
row[colName] = rowData[colCnt]
Expand All @@ -866,7 +866,7 @@ def __do_query_into_hash(conn, sqlStr):
rtnResults.append(row)

cursor.close()
log.debug(('%s-->' % mod))
log.debug(('%s-->' % mod))
return rtnResults

def get_master_status():
Expand All @@ -893,10 +893,10 @@ def get_master_status():
# check for if this minion is not a master
if (len(rtnv) == 0):
rtnv.append([])
log.debug("%s-->%d" % (mod, len(rtnv[0])))

log.debug("%s-->%d" % (mod, len(rtnv[0])))
return rtnv[0]

def get_slave_status():
'''
Retrieves the slave status from the minion.
Expand Down Expand Up @@ -957,6 +957,6 @@ def get_slave_status():
# check for if this minion is not a slave
if (len(rtnv) == 0):
rtnv.append([])
log.debug("%s-->%d" % (mod, len(rtnv[0])))

log.debug("%s-->%d" % (mod, len(rtnv[0])))
return rtnv[0]

0 comments on commit 0133d7e

Please sign in to comment.