mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 02:38:03 +00:00 
			
		
		
		
	lf_cisco_power.py: email/text on completion of test
lf_mail.py : slight formatting change
This commit is contained in:
		| @@ -1414,11 +1414,26 @@ def main(): | ||||
|                                      email_out = subprocess.run(["./lf_mail.py", "--user", email_dict['user'] , "--passwd", email_dict['passwd'], "--to",email_dict['to'] ,  | ||||
|                                        "--subject", subject, "--body", body , "--smtp", email_dict['smtp'], "--port", email_dict['port'] ], capture_output=cap_ctl_out, check=True) | ||||
|                                      pss = email_out.stdout.decode('utf-8','ignore') | ||||
|                                      logg.info(pss) | ||||
|                                   except subprocess.CalledProcessError as process_error: | ||||
|                                     logg.info("Unable to send email smtp {} port {} error code: {} output {}".format(email_dict['smtp'],email_dict['port'],process_error.returncode, process_error.output)) | ||||
|                            exit_test(workbook) | ||||
|                              | ||||
|  | ||||
|    if bool(email_dicts): | ||||
|        for email_dict in email_dicts: | ||||
|            try: | ||||
|                logg.info("Sending Email ") | ||||
|                subject = "Lanforge Test Compete" | ||||
|                body    = "Lanforeg Test Complete : AP: {} time_stamp: {}".format(args.ap, time_stamp) | ||||
|                email_out = subprocess.run(["./lf_mail.py", "--user", email_dict['user'] , "--passwd", email_dict['passwd'], "--to",email_dict['to'] ,  | ||||
|                "--subject", subject, "--body", body , "--smtp", email_dict['smtp'], "--port", email_dict['port'] ], capture_output=cap_ctl_out, check=True) | ||||
|                pss = email_out.stdout.decode('utf-8','ignore') | ||||
|                logg.info(pss) | ||||
|            except subprocess.CalledProcessError as process_error: | ||||
|                logg.info("Unable to send email smtp {} port {} error code: {} output {}".format(email_dict['smtp'],email_dict['port'],process_error.returncode, process_error.output)) | ||||
|  | ||||
|  | ||||
|    workbook.close() | ||||
|  | ||||
|    # check if keeping the existing state | ||||
|   | ||||
| @@ -53,7 +53,7 @@ def main(): | ||||
|     parser.add_argument("-b", "--body",      type=str, help="email body      --body <body text>", required = True) | ||||
|     parser.add_argument("-s,", "--smtp",     type=str, help="smtp server     --smtp <smtp server>  default  smtp.gmail.com ", default="smtp.gmail.com") | ||||
|     parser.add_argument("-p,", "--port",     type=str, help="smtp port       --port <port>  default 465 (SSL)", default="465") | ||||
|     parser.add_argument("-l", "--log",      type=str, help="logfile for messages, stdout means output to console",default="stdout") | ||||
|     parser.add_argument("-l", "--log",       type=str, help="logfile for messages, stdout means output to console",default="stdout") | ||||
|  | ||||
|  | ||||
|     args = None | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Chuck SmileyRekiere
					Chuck SmileyRekiere