From ec139aa22c9da9c73adbaeb59eff941d4c707ee4 Mon Sep 17 00:00:00 2001
From: Bo-Chun Louis Chen <louistw@uab.edu>
Date: Mon, 16 May 2022 13:51:53 -0500
Subject: [PATCH] Update account manager with updated_by field

---
 account_manager.py                    | 1 +
 prod_rmq_agents/acct_mgmt_workflow.py | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/account_manager.py b/account_manager.py
index 98e7a3b..709f5db 100755
--- a/account_manager.py
+++ b/account_manager.py
@@ -40,6 +40,7 @@ msg["username"] = username
 msg["state"] = state
 msg["service"] = service
 msg["queuename"] = queuename
+msg["updated_by"] = rc_util.get_caller_info()
 
 # publish msg with acctmgr.{uname} routing key.
 rc_rmq.publish_msg(
diff --git a/prod_rmq_agents/acct_mgmt_workflow.py b/prod_rmq_agents/acct_mgmt_workflow.py
index 7b7bc0c..3f39736 100755
--- a/prod_rmq_agents/acct_mgmt_workflow.py
+++ b/prod_rmq_agents/acct_mgmt_workflow.py
@@ -37,7 +37,7 @@ def manage_acct(ch, method, properties, body):
             msg["action"] = "unlock"
         else:
             print("Invalid state provided. Check the help menu.")
-        
+
         if service == 'all':
             current["new_jobs"] = None
             current["expire_account"] = None
@@ -54,7 +54,7 @@ def manage_acct(ch, method, properties, body):
                 rc_rmq.publish_msg(
                     {
                         "routing_key": f"{each_service}.{queuename}",
-                        "msg": msg 
+                        "msg": msg
                     }
                 )
 
@@ -70,8 +70,8 @@ def manage_acct(ch, method, properties, body):
                 done = False
 
         if done:
-            rc_util.update_state(username, state)
-    
+            rc_util.update_state(username, state, msg.get("updated_by"))
+
             # Send done msg to account_manager.py
             rc_rmq.publish_msg(
                 {
-- 
GitLab