def prepare(report_processor, raw_operation_list, default_operation_list, allowed_operation_name_list, allow_invalid=False): """ Return operation_list prepared from raw_operation_list and default_operation_list. report_processor is tool for warning/info/error reporting list of dicts raw_operation_list are entered operations that require follow-up care list of dicts default_operation_list are operations defined as default by (most probably) resource agent bool allow_invalid is flag for validation skipping """ operations_to_validate = operations_to_normalized(raw_operation_list) report_list = [] report_list.extend( validate_operation_list(operations_to_validate, allowed_operation_name_list, allow_invalid)) operation_list = normalized_to_operations(operations_to_validate) report_list.extend(validate_different_intervals(operation_list)) #can raise LibraryError report_processor.process_list(report_list) return complete_all_intervals(operation_list) + get_remaining_defaults( report_processor, operation_list, default_operation_list)
def prepare( report_processor, raw_operation_list, default_operation_list, allowed_operation_name_list, allow_invalid=False ): """ Return operation_list prepared from raw_operation_list and default_operation_list. report_processor is tool for warning/info/error reporting list of dicts raw_operation_list are entered operations that require follow-up care list of dicts default_operation_list are operations defined as default by (most probably) resource agent bool allow_invalid is flag for validation skipping """ operations_to_validate = [ validate.values_to_pairs(op, normalize) for op in raw_operation_list ] report_list = [] options_validators = OPERATION_OPTIONS_VALIDATORS + [ validate.value_in( "name", allowed_operation_name_list, option_name_for_report="operation name", code_to_allow_extra_values=report_codes.FORCE_OPTIONS, allow_extra_values=allow_invalid, ) ] for operation in operations_to_validate: report_list.extend( validate_operation(operation, options_validators) ) operation_list = [ validate.pairs_to_values(op) for op in operations_to_validate ] report_list.extend(validate_different_intervals(operation_list)) #can raise LibraryError report_processor.process_list(report_list) return complete_all_intervals(operation_list) + get_remaining_defaults( report_processor, operation_list, default_operation_list )