def resource_agent_error_to_report_item(e, severity=ReportItemSeverity.ERROR, forceable=False): """ Transform ResourceAgentError to ReportItem """ force = None if e.__class__ == UnableToGetAgentMetadata: if severity == ReportItemSeverity.ERROR and forceable: force = report_codes.FORCE_METADATA_ISSUE return reports.unable_to_get_agent_metadata(e.agent, e.message, severity, force) if e.__class__ == InvalidResourceAgentName: return reports.invalid_resource_agent_name(e.agent) raise e
def resource_agent_error_to_report_item(e, severity=ReportItemSeverity.ERROR, forceable=False): """ Transform ResourceAgentError to ReportItem """ force = None if e.__class__ == UnableToGetAgentMetadata: if severity == ReportItemSeverity.ERROR and forceable: force = report_codes.FORCE_METADATA_ISSUE return reports.unable_to_get_agent_metadata(e.agent, e.message, severity, force) if e.__class__ == InvalidResourceAgentName: return reports.invalid_resource_agent_name(e.agent) raise e