use of com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionFailureEvent in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method failedAction.
@Bean(name = "DIAGNOSTICS_COLLECTION_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionFailureEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionFailureEvent payload, Map<Object, Object> variables) {
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_COLLECTION_FAILED_STATE. resourceCrn: '{}'", resourceCrn);
InMemoryStateStore.deleteStack(payload.getResourceId());
DiagnosticParameters parameters = payload.getParameters();
if (payload.getException() != null) {
parameters.setStatusReason(payload.getException().getMessage());
}
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(parameters).build();
diagnosticsOperationsService.vmDiagnosticsReport(resourceCrn, payload.getParameters(), UsageProto.CDPVMDiagnosticsFailureType.Value.valueOf(payload.getFailureType()), payload.getException());
sendEvent(context, event);
}
};
}
Aggregations