use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsCleanupAction.
@Bean(name = "DIAGNOSTICS_CLEANUP_STATE")
public Action<?, ?> diagnosticsCleanupAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
Long resourceId = payload.getResourceId();
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_CLEANUP_STATE. resourceCrn: '{}'", resourceCrn);
cloudbreakEventService.fireCloudbreakEvent(resourceId, UPDATE_IN_PROGRESS.name(), ResourceEvent.STACK_DIAGNOSTICS_CLEANUP_RUNNING);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(resourceId).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionHandlerSelectors.CLEANUP_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).withHosts(payload.getHosts()).withHostGroups(payload.getHostGroups()).withExcludeHosts(payload.getExcludeHosts()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsPreFlightCheckAction.
@Bean(name = "DIAGNOSTICS_PREFLIGHT_CHECK_STATE")
public Action<?, ?> diagnosticsPreFlightCheckAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
Long resourceId = payload.getResourceId();
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_PREFLIGHT_CHECK_STATE. resourceCrn: '{}'", resourceCrn);
cloudbreakEventService.fireCloudbreakEvent(resourceId, UPDATE_IN_PROGRESS.name(), ResourceEvent.STACK_DIAGNOSTICS_PREFLIGHT_CHECK_RUNNING);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(resourceId).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).withHosts(payload.getHosts()).withHostGroups(payload.getHostGroups()).withExcludeHosts(payload.getExcludeHosts()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsCollectionAction.
@Bean(name = "DIAGNOSTICS_COLLECTION_STATE")
public Action<?, ?> diagnosticsCollectionAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
Long resourceId = payload.getResourceId();
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_COLLECTION_STATE. resourceCrn: '{}'", resourceCrn);
cloudbreakEventService.fireCloudbreakEvent(resourceId, UPDATE_IN_PROGRESS.name(), ResourceEvent.STACK_DIAGNOSTICS_COLLECTION_RUNNING, List.of(payload.getParameters().getDestination().toString()));
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(resourceId).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionHandlerSelectors.COLLECT_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).withHosts(payload.getHosts()).withHostGroups(payload.getHostGroups()).withExcludeHosts(payload.getExcludeHosts()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsUpgradeTelemetryAction.
@Bean(name = "DIAGNOSTICS_UPGRADE_STATE")
public Action<?, ?> diagnosticsUpgradeTelemetryAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
Long resourceId = payload.getResourceId();
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_UPGRADE_STATE. resourceCrn: '{}'", resourceCrn);
cloudbreakEventService.fireCloudbreakEvent(resourceId, UPDATE_IN_PROGRESS.name(), ResourceEvent.STACK_DIAGNOSTICS_TELEMETRY_UPGRADE_RUNNING);
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(resourceId).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionHandlerSelectors.UPGRADE_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).withHosts(payload.getHosts()).withHostGroups(payload.getHostGroups()).withExcludeHosts(payload.getExcludeHosts()).build();
sendEvent(context, event);
}
};
}
use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.
the class DiagnosticsCollectionActions method diagnosticsSaltValidationAction.
@Bean(name = "DIAGNOSTICS_SALT_VALIDATION_STATE")
public Action<?, ?> diagnosticsSaltValidationAction() {
return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {
@Override
protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
Long resourceId = payload.getResourceId();
String resourceCrn = payload.getResourceCrn();
LOGGER.debug("Flow entered into DIAGNOSTICS_SALT_VALIDATION_STATE. resourceCrn: '{}'", resourceCrn);
InMemoryStateStore.putStack(resourceId, PollGroup.POLLABLE);
String excludedHosts = CollectionUtils.isEmpty(payload.getParameters().getExcludeHosts()) ? "[NONE]" : String.format("[%s]", String.join(",", payload.getParameters().getExcludeHosts()));
if (payload.getParameters().getSkipUnresponsiveHosts()) {
cloudbreakEventService.fireCloudbreakEvent(resourceId, UPDATE_IN_PROGRESS.name(), ResourceEvent.STACK_DIAGNOSTICS_SALT_VALIDATION_RUNNING_SKIP_UNRESPONSIVE, List.of(excludedHosts));
} else {
cloudbreakEventService.fireCloudbreakEvent(resourceId, UPDATE_IN_PROGRESS.name(), ResourceEvent.STACK_DIAGNOSTICS_SALT_VALIDATION_RUNNING, List.of(excludedHosts));
}
DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(resourceId).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.SALT_VALIDATION_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).withHosts(payload.getHosts()).withHostGroups(payload.getHostGroups()).withExcludeHosts(payload.getExcludeHosts()).build();
sendEvent(context, event);
}
};
}
Aggregations