Commit a9c40ab3 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

cleanup: Correction

parent 92199ffc
......@@ -153,15 +153,16 @@ def cleanup():
raise e
cur.execute("select user_index,login from users where expires_at < now();")
old_users = [u[0] for u in cur.fetchall()]
logging.debug("%d users to delete : %s"%(len(old_users), old_users))
old_users_entries = cur.fetchall()
old_users = ','.join( str(u[0]) for u in old_users_entries )
logging.debug("Users to delete : %s"%(len(old_users), old_users))
try :
cur.execute("""
delete from credentials where user_index in (%s)
""", ','.join(old_users))
""", old_users)
cur.execute("""
delete from users where user_index in (%s)
""", ','.join(old_users))
""", old_users)
except Exception as e:
logging.error("Unable de delete from credentials or users")
logging.error(e)
......@@ -185,7 +186,7 @@ def cleanup():
logging.debug("Deleting from privileges database")
cur.execute("""
delete from eida_temp_users where name in (%s);
""", ','.join(old_users))
""", ','.join(str(u[1]) for u in old_users_entries))
conn.commit()
conn.close()
return Response("Deleted %d temporary accounts."%(len(users)), status=200)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment