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

Use parameters from the rabbit config file in subscribe_mail_list

parent 02bb215a
No related branches found
No related tags found
4 merge requests!147Merge previous default branch feat-cod-rmq into main,!85kill nginx process running under user from login node,!78Feat cod rmq,!60Use a single merged config file for all agents
...@@ -7,6 +7,7 @@ import argparse ...@@ -7,6 +7,7 @@ import argparse
import rc_util import rc_util
from email.message import EmailMessage from email.message import EmailMessage
from rc_rmq import RCRMQ from rc_rmq import RCRMQ
import rabbit_config as rcfg
task = 'subscribe_mail_list' task = 'subscribe_mail_list'
...@@ -28,8 +29,10 @@ def mail_list_subscription(ch, method, properties, body): ...@@ -28,8 +29,10 @@ def mail_list_subscription(ch, method, properties, body):
fullname = msg['fullname'] fullname = msg['fullname']
email = msg['email'] email = msg['email']
mail_list_admin = 'root@localhost' #change this during deploy mail_list_admin = rcfg.Sender
mail_list = 'LISTSERV@LISTSERV.UAB.EDU' mail_list = rcfg.Mail_list
mail_list_bcc = rcfg.Mail_list_bcc
server = rcfg.Server
listserv_cmd = f'QUIET ADD hpc-announce {email} {fullname} \ listserv_cmd = f'QUIET ADD hpc-announce {email} {fullname} \
\nQUIET ADD hpc-users {email} {fullname}' \nQUIET ADD hpc-users {email} {fullname}'
...@@ -43,9 +46,10 @@ def mail_list_subscription(ch, method, properties, body): ...@@ -43,9 +46,10 @@ def mail_list_subscription(ch, method, properties, body):
email_msg['From'] = mail_list_admin email_msg['From'] = mail_list_admin
email_msg['To'] = mail_list email_msg['To'] = mail_list
email_msg['Subject'] = '' email_msg['Subject'] = ''
email_msg['Bcc'] = mail_list_bcc
# Create an smtp object and send email # Create an smtp object and send email
s = smtplib.SMTP('localhost') s = smtplib.SMTP(server)
email_msg.set_content(listserv_cmd) email_msg.set_content(listserv_cmd)
if not args.dry_run: if not args.dry_run:
......
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