Untitled
unknown
plain_text
2 years ago
1.2 kB
9
Indexable
def notify_support_team(vm_id,vm_ip,username):
config = param_config(configdata=True,subject='CAPE Agent')
cape_agent = config.agent_ip
vm_id = vm_id
vm_ip = vm_ip
vm_username = username
to = 'kumar.ayush12@tcs.com,anish.aich@tcs.com,biswanath.b@tcs.com'
cc = 'sameer.herkal@tcs.com,savleen.kaur@tcs.com'
name = 'CAPE_ADMIN'
from_ = 'capesupport@tcsprocesscloud.com'
subject = 'Test Mail for VM User Password Reset'+" on CAPE Agent server - "+cape_agent
message1='Password was reset for VM User-'+vm_username+' with VM_ID-'+str(vm_id)+' and VM_IP-'+vm_ip+'.\n'
message2='New password was updated in agent.properties file on CAPE Agent-'+cape_agent+'.'+' Also, the SAP Services were restarted.'
message = message1+"\n"+message2
body = 'Dear Team,\n\n'+message+'\n\nRegards,\nCAPE ADMIN.'
#body = 'This is a test email sent from a Python script.'
command = f"echo '{body}' | mutt -e 'my_hdr From:{name} <{from_}>' -e 'my_hdr Cc:{cc}' -s '{subject}' {to}"
try:
subprocess.run(command, shell=True)
except Exception as e:
print("Exception raised: ", e)
logging.error("Exception raised %s ",e)
return NoneEditor is loading...