Commit 23aba0cb authored by Benjamin Baer's avatar Benjamin Baer
Browse files

test if 2 replies work

parent e9f7e266
......@@ -36,18 +36,28 @@ class LogoutUser(managementagent.RabbitModule):
returnCode = subprocess.call(['/usr/bin/pkill', '-u', username, ' tl-xinit'])
time.sleep(5)
subprocess.call(['/usr/bin/pkill', '-u', username, '-KILL'])
returnCode2 = subprocess.call(['/usr/bin/pkill', '-u', username, '-KILL'])
if returnCode == 0:
logger.info("User %s logout succesfull", username)
self.send_reply(reply_to, 0, "Ended sessions for %s" % (username,))
elif returnCode == 1:
logger.warning("User %s not logged in", username)
self.send_reply(reply_to, returnCode, "pkill command did no matching process (%i) for user %s" % (returnCode, username))
self.send_reply(reply_to, returnCode, "pkill command did find no matching process (%i) for user %s" % (returnCode, username))
else:
logger.warning("Failed to logout user %s", username)
self.send_reply(reply_to, returnCode, "Error executing pkill command (%i) for user %s" % (returnCode, username))
if returnCode2 == 0:
logger.info("User %s processes killed", username)
self.send_reply(reply_to, 0, "Killed processes for %s" % (username,))
elif returnCode2 == 1:
logger.warning("User %s no processes found", username)
self.send_reply(reply_to, returnCode, "pkill command did find no matching processes (%i) for user %s" % (returnCode2, username))
else:
logger.warning("Failed to logout user %s", username)
self.send_reply(reply_to, returnCode, "Error executing pkill command (%i) for user %s" % (returnCode2, username))
except Exception as ex:
self.send_reply(reply_to, -1, repr(ex))
......
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