Skip to content
Snippets Groups Projects
Commit 42b8c4df authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Split updated_by in agents and scripts

parent ffdf3308
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ msg["username"] = username ...@@ -40,7 +40,7 @@ msg["username"] = username
msg["state"] = state msg["state"] = state
msg["service"] = service msg["service"] = service
msg["queuename"] = queuename msg["queuename"] = queuename
msg["updated_by"] = rc_util.get_caller_info() msg["updated_by"], msg["host"] = rc_util.get_caller_info()
# publish msg with acctmgr.{uname} routing key. # publish msg with acctmgr.{uname} routing key.
rc_rmq.publish_msg( rc_rmq.publish_msg(
......
...@@ -25,7 +25,7 @@ args = parser.parse_args() ...@@ -25,7 +25,7 @@ args = parser.parse_args()
timeout = 60 timeout = 60
queuename = rc_util.encode_name(args.username) queuename = rc_util.encode_name(args.username)
updated_by = rc_util.get_caller_info() updated_by, host = rc_util.get_caller_info()
if args.email == "": if args.email == "":
args.email = args.username args.email = args.username
...@@ -60,6 +60,7 @@ rc_util.add_account( ...@@ -60,6 +60,7 @@ rc_util.add_account(
full=args.full_name, full=args.full_name,
reason=args.reason, reason=args.reason,
updated_by=updated_by, updated_by=updated_by,
host=host,
) )
print(f"Account for {args.username} requested.") print(f"Account for {args.username} requested.")
......
...@@ -16,7 +16,7 @@ args = parser.parse_args() ...@@ -16,7 +16,7 @@ args = parser.parse_args()
default_state = "ok" default_state = "ok"
today = datetime.now() today = datetime.now()
updated_by = rc_util.get_caller_info() updated_by, host = rc_util.get_caller_info()
# Chunk size for insert into db # Chunk size for insert into db
size = 1000 size = 1000
...@@ -45,6 +45,7 @@ if len(users) > 50: ...@@ -45,6 +45,7 @@ if len(users) > 50:
state=default_state, state=default_state,
date=today, date=today,
updated_by=updated_by, updated_by=updated_by,
host=host,
) )
for user in users[start:end] for user in users[start:end]
] ]
...@@ -66,5 +67,6 @@ else: ...@@ -66,5 +67,6 @@ else:
"state": default_state, "state": default_state,
"date": today, "date": today,
"updated_by": updated_by, "updated_by": updated_by,
"host": host,
} }
) )
...@@ -70,7 +70,9 @@ def manage_acct(ch, method, properties, body): ...@@ -70,7 +70,9 @@ def manage_acct(ch, method, properties, body):
done = False done = False
if done: if done:
rc_util.update_state(username, state, msg.get("updated_by")) rc_util.update_state(
username, state, msg.get("updated_by"), msg.get("host")
)
# Send done msg to account_manager.py # Send done msg to account_manager.py
rc_rmq.publish_msg( rc_rmq.publish_msg(
......
...@@ -277,7 +277,9 @@ def task_manager(ch, method, properties, body): ...@@ -277,7 +277,9 @@ def task_manager(ch, method, properties, body):
update_db(username, {"reported": True}) update_db(username, {"reported": True})
rc_util.update_state(username, "ok", msg.get("updated_by")) rc_util.update_state(
username, "ok", msg.get("updated_by"), msg.get("host")
)
tracking.pop(username) tracking.pop(username)
......
...@@ -23,6 +23,7 @@ def user_state(ch, method, properties, body): ...@@ -23,6 +23,7 @@ def user_state(ch, method, properties, body):
msg = json.loads(body) msg = json.loads(body)
username = msg["username"] username = msg["username"]
updated_by = msg.get("updated_by") updated_by = msg.get("updated_by")
host = msg.get("host")
op = msg["op"] op = msg["op"]
msg["success"] = False msg["success"] = False
errmsg = "" errmsg = ""
...@@ -53,6 +54,7 @@ def user_state(ch, method, properties, body): ...@@ -53,6 +54,7 @@ def user_state(ch, method, properties, body):
"state": state, "state": state,
"date": datetime.now(), "date": datetime.now(),
"updated_by": updated_by, "updated_by": updated_by,
"host": host,
} }
) )
logger.debug(f"User {username} state updates to {state}") logger.debug(f"User {username} state updates to {state}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment