diff --git a/unskript-ctl/unskript_ctl_notification.py b/unskript-ctl/unskript_ctl_notification.py index 4b48587ac..70ef0a0da 100644 --- a/unskript-ctl/unskript_ctl_notification.py +++ b/unskript-ctl/unskript_ctl_notification.py @@ -198,10 +198,10 @@ def create_temp_files_of_failed_check_results(self, return list_of_failed_files def create_script_summary_message(self, output_metadata_file: str): - # message = '' + message = '' if os.path.exists(output_metadata_file) is False: self.logger.error(f"ERROR: The metadata file is missing, please check if file exists? {output_metadata_file}") - return '' + return message metadata = '' with open(output_metadata_file, 'r', encoding='utf-8') as f: @@ -215,24 +215,24 @@ def create_script_summary_message(self, output_metadata_file: str): self.logger.debug(f"\tStatus: {metadata.get('status')} \n\tTime (in seconds): {metadata.get('time_taken')} \n\tError: {metadata.get('error')} \n") # Remove from email - # message += f''' - #
- #

Custom Script Run Result

- # - # - # - # - # - # - # - # - # - # - # - #
Status Time (in seconds) Error
{metadata.get('status')}{metadata.get('time_taken')}{metadata.get('error')}
- # ''' - - return '' + message += f''' +
+

Custom Script Run Result

+ + + + + + + + + + + +
Status Time (in seconds) Error
{metadata.get('status')}{metadata.get('time_taken')}{metadata.get('error')}
+ ''' + + return message def create_info_legos_output_file(self): """create_info_legos_output_file: This function creates a file that will @@ -469,6 +469,10 @@ def prepare_combined_email(self, if info_result: message += info_result self.create_info_legos_output_file() + # print("Output Metadata File\n",output_metadata_file) + if output_metadata_file: + message += self.create_script_summary_message(output_metadata_file=output_metadata_file) + temp_attachment = self.create_email_attachment(output_metadata_file=output_metadata_file) if len(os.listdir(self.execution_dir)) == 0 or not self.create_tarball_archive(tar_file_name=tar_file_name, output_metadata_file=None, parent_folder=parent_folder): self.logger.error("Execution directory is empty , tarball creation unsuccessful!") @@ -560,6 +564,9 @@ def send_sendgrid_notification(self, if len(os.listdir(self.execution_dir)) == 0 or not self.create_tarball_archive(tar_file_name=tar_file_name, output_metadata_file=None, parent_folder=parent_folder): self.logger.error("Execution directory is empty , tarball creation unsuccessful!") + if output_metadata_file: + html_message += self.create_script_summary_message(output_metadata_file=output_metadata_file) + info_result = self.create_info_gathering_action_result() if info_result: html_message += info_result