Skip to content
Snippets Groups Projects
Commit 9fb10be1 authored by Eesaan Atluri's avatar Eesaan Atluri
Browse files

Use full name from the current user_record

parent d5fda706
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,6 @@ Whole_mail = Head + Body ...@@ -31,6 +31,6 @@ Whole_mail = Head + Body
UserReportHead = f"""From: {Sender_alias} <{Sender}> UserReportHead = f"""From: {Sender_alias} <{Sender}>
To: <{Admin_email}> To: <{Admin_email}>
Subject: RC Account Creation Report: {{{{ fullname }}}}, {{{{ username }}}} Subject: RC Account Creation Report: {{{{ fullname }}}}, {{{{ username }}}}
""" """
...@@ -48,9 +48,9 @@ tracking = {} ...@@ -48,9 +48,9 @@ tracking = {}
# Instantiate rabbitmq object # Instantiate rabbitmq object
rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'}) rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'})
def notify_admin(username, fullname, user_record): def notify_admin(username, user_record):
receivers = [user_record['email'], mail_cfg.Admin_email] receivers = [user_record['email'], mail_cfg.Admin_email]
message = Template(mail_cfg.UserReportHead).render(username=username, fullname=fullname) message = Template(mail_cfg.UserReportHead).render(username=username, fullname=user_record['fullname'])
message += f""" \n message += f""" \n
User Creation Report for user {username} User Creation Report for user {username}
uid: {user_record["uid"]}, gid: {user_record["gid"]} uid: {user_record["uid"]}, gid: {user_record["gid"]}
...@@ -113,7 +113,6 @@ def update_db(username, data): ...@@ -113,7 +113,6 @@ def update_db(username, data):
def task_manager(ch, method, properties, body): def task_manager(ch, method, properties, body):
msg = json.loads(body) msg = json.loads(body)
username = method.routing_key.split('.')[1] username = method.routing_key.split('.')[1]
fullname = msg['fullname']
task_name = msg['task'] task_name = msg['task']
success = msg['success'] success = msg['success']
send = completed = terminated = False send = completed = terminated = False
...@@ -244,7 +243,7 @@ def task_manager(ch, method, properties, body): ...@@ -244,7 +243,7 @@ def task_manager(ch, method, properties, body):
# Send report to admin # Send report to admin
if completed or terminated: if completed or terminated:
notify_admin(username, fullname, current) notify_admin(username, current)
update_db(username, {'reported': True}) update_db(username, {'reported': True})
......
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