Commit c0618fd5 authored by Benjamin Baer's avatar Benjamin Baer
Browse files

More readable warnings (pkill status = 1: no process matched - not an error)

parent c850dcd1
......@@ -38,13 +38,15 @@ class LogoutUser(managementagent.RabbitModule):
time.sleep(5)
subprocess.call(['/usr/bin/pkill', '-u', username, '-KILL'])
if returnCode != 0:
logger.warning("Failed to logout user %s", username)
self.send_reply(reply_to, returnCode, "Error executing pkill command (%i) for user %s" % (returnCode, username))
else:
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))
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))
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