I need to check with Python if a SQL query contains a number in a list, to set a value for another var. My solution is only going into the "else" statement evrytime...
def check_failures (GID):
conf.conn.ping (True)
conf.db.execute ("""SELECT failure, ID
FROM server
WHERE GID = %s;""", ( GID ))
if conf.db.rowcount == 1:
"""
fail_row[0]: failure
fail_row[1]: ID
"""
fail_row = list (conf.db.fetchone ())
return fail_row
[...]
def check_running (running):
[..]
MIDS = [533, 534, 535, 536, 537, 538, 539];
fail_row = check_failures(server)
if fail_row[1] in MIDS:
maxfaults = 1
else:
maxfaults = 5
if not server in working and fail_row[0] <= maxfaults :
[...]
Aucun commentaire:
Enregistrer un commentaire