diff --git a/src/core/src/service_interfaces/StatusHandler.py b/src/core/src/service_interfaces/StatusHandler.py index 6814cdbc..50d593e8 100644 --- a/src/core/src/service_interfaces/StatusHandler.py +++ b/src/core/src/service_interfaces/StatusHandler.py @@ -838,13 +838,10 @@ def __try_add_error(error_list, detail): def __set_errors_json(self, error_count_by_operation, errors_by_operation): """ Compose the error object json to be added in 'errors' in given operation's summary """ - success_code = Constants.PatchOperationTopLevelErrorCode.SUCCESS - error_code = Constants.PatchOperationTopLevelErrorCode.ERROR - error_count = error_count_by_operation - code = success_code if error_count_by_operation == 0 else error_code + code = Constants.PatchOperationTopLevelErrorCode.SUCCESS if error_count_by_operation == 0 else Constants.PatchOperationTopLevelErrorCode.ERROR - message = "{0} error/s reported.".format(error_count) - message += " The latest {0} error/s are shared in detail. To view all errors, review this log file on the machine: {1}".format(len(errors_by_operation), self.__log_file_path) if error_count > 0 else "" + message = "{0} error/s reported.".format(error_count_by_operation) + message += " The latest {0} error/s are shared in detail. To view all errors, review this log file on the machine: {1}".format(len(errors_by_operation), self.__log_file_path) if error_count_by_operation > 0 else "" return { "code": code, "details": errors_by_operation, @@ -945,20 +942,14 @@ def __create_truncated_status_file(self, status_file_size_in_bytes, complete_sta truncated_status_file = self.__recompose_truncated_status_file(truncated_status_file=truncated_status_file, truncated_package_list=packages_retained_in_installation, truncated_substatus_msg=self.__installation_substatus_msg_copy, substatus_index=installation_substatus_index) - status_file_size_in_bytes, status_file_agent_size_diff = self.__get_new_size_in_bytes_after_truncation(truncated_status_file) + status_file_size_in_bytes = self.__calc_status_size_on_disk(json.dumps(truncated_status_file)) + status_file_agent_size_diff = status_file_size_in_bytes - self.__internal_file_capacity size_of_max_packages_allowed_in_status -= status_file_agent_size_diff # Reduce the max packages byte size by tombstone, new error, and escape chars byte size self.composite_logger.log_debug("End package list truncation") return truncated_status_file - def __get_new_size_in_bytes_after_truncation(self, truncated_status_file): - """ Get new size in bytes for status_file,and difference of status file - 126kb """ - status_file_size_in_bytes = self.__calc_status_size_on_disk(json.dumps(truncated_status_file)) - status_file_agent_size_diff = status_file_size_in_bytes - self.__internal_file_capacity - - return status_file_size_in_bytes, status_file_agent_size_diff - def __split_assessment_list(self, assessment_packages): """ Split package list, keep 5 minimum packages, and remaining packages for truncation """ min_packages_count = Constants.StatusTruncationConfig.MIN_ASSESSMENT_PACKAGE_TO_RETAIN