diff --git a/prod_rmq_agents/new_jobs.py b/prod_rmq_agents/new_jobs.py index 4ef2f292d4085b7d098450a5c77a37317e9909ee..5f260773d6857e86aa630ca537087fbcc41fe632 100644 --- a/prod_rmq_agents/new_jobs.py +++ b/prod_rmq_agents/new_jobs.py @@ -21,7 +21,8 @@ def new_jobs(ch, method, properties, body): msg = json.loads(body) username = msg["username"] action = msg["action"] - msg["success"] = False + msg["success"] = {} + msg["success"][task] = False corr_id = properties.correlation_id reply_to = properties.reply_to @@ -35,10 +36,11 @@ def new_jobs(ch, method, properties, body): elif action == 'unlock': unblock_new_jobs = popen(unblock_new_jobs_cmd).read().rstrip() - msg["success"] = True + msg["success"][task] = True + logger.info(f"Succeeded in blocking {username}'s jobs getting to run state") except Exception: - msg["success"] = False + msg["success"][task] = False msg["errmsg"] = "Exception raised while setting maxjobs that can enter run state, check the logs for stack trace" logger.error("", exc_info=True) diff --git a/prod_rmq_agents/ssh_access.py b/prod_rmq_agents/ssh_access.py index 044bf579cad0650fe747fa9e6b489ce72bbd8245..6d85b4326d149606efd32afad8a6b0418bc0a63d 100644 --- a/prod_rmq_agents/ssh_access.py +++ b/prod_rmq_agents/ssh_access.py @@ -21,7 +21,8 @@ def ssh_access(ch, method, properties, body): msg = json.loads(body) username = msg["username"] action = msg["action"] - msg["success"] = False + msg["success"] = {} + msg["success"][task] = False corr_id = properties.correlation_id reply_to = properties.reply_to @@ -35,10 +36,11 @@ def ssh_access(ch, method, properties, body): elif action == 'unlock': unblock_ssh = popen(unblock_ssh_cmd).read().rstrip() - msg["success"] = True + msg["success"][task] = True + logger.info(f"User {username} is added to nossh group") except Exception: - msg["success"] = False + msg["success"][task] = False msg["errmsg"] = "Exception raised, while blocking user's ssh access, check the logs for stack trace" logger.error("", exc_info=True)