Search in sources :

Example 81 with CommonContext

use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.

the class DiagnosticsCollectionActions method diagnosticsVmPreFlightCheckAction.

@Bean(name = "DIAGNOSTICS_VM_PREFLIGHT_CHECK_STATE")
public Action<?, ?> diagnosticsVmPreFlightCheckAction() {
    return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {

        @Override
        protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
            String resourceCrn = payload.getResourceCrn();
            LOGGER.debug("Flow entered into DIAGNOSTICS_VM_PREFLIGHT_CHECK_STATE. resourceCrn: '{}'", resourceCrn);
            DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.VM_PREFLIGHT_CHECK_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
            sendEvent(context, event);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 82 with CommonContext

use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.

the class DiagnosticsCollectionActions method diagnosticsSaltValidateAction.

@Bean(name = "DIAGNOSTICS_SALT_VALIDATION_STATE")
public Action<?, ?> diagnosticsSaltValidateAction() {
    return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {

        @Override
        protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
            String resourceCrn = payload.getResourceCrn();
            LOGGER.debug("Flow entered into DIAGNOSTICS_SALT_VALIDATION_STATE. resourceCrn: '{}'", resourceCrn);
            InMemoryStateStore.putStack(payload.getResourceId(), PollGroup.POLLABLE);
            DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.SALT_VALIDATION_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
            sendEvent(context, event);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 83 with CommonContext

use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.

the class DiagnosticsCollectionActions method diagnosticsSaltStateUpdateAction.

@Bean(name = "DIAGNOSTICS_SALT_STATE_UPDATE_STATE")
public Action<?, ?> diagnosticsSaltStateUpdateAction() {
    return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {

        @Override
        protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
            String resourceCrn = payload.getResourceCrn();
            LOGGER.debug("Flow entered into DIAGNOSTICS_SALT_STATE_UPDATE_STATE. resourceCrn: '{}'", resourceCrn);
            DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(resourceCrn).withSelector(DiagnosticsCollectionHandlerSelectors.SALT_STATE_UPDATE_DIAGNOSTICS_EVENT.selector()).withParameters(payload.getParameters()).build();
            sendEvent(context, event);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 84 with CommonContext

use of com.sequenceiq.flow.core.CommonContext in project cloudbreak by hortonworks.

the class DiagnosticsCollectionActions method diagnosticsCollectionFinishedAction.

@Bean(name = "DIAGNOSTICS_COLLECTION_FINISHED_STATE")
public Action<?, ?> diagnosticsCollectionFinishedAction() {
    return new AbstractDiagnosticsCollectionActions<>(DiagnosticsCollectionEvent.class) {

        @Override
        protected void doExecute(CommonContext context, DiagnosticsCollectionEvent payload, Map<Object, Object> variables) {
            String resourceCrn = payload.getResourceCrn();
            LOGGER.debug("Flow entered into DIAGNOSTICS_COLLECTION_FINISHED_STATE. resourceCrn: '{}'", resourceCrn);
            InMemoryStateStore.deleteStack(payload.getResourceId());
            DiagnosticsCollectionEvent event = DiagnosticsCollectionEvent.builder().withResourceId(payload.getResourceId()).withResourceCrn(payload.getResourceCrn()).withSelector(DiagnosticsCollectionStateSelectors.FINALIZE_DIAGNOSTICS_COLLECTION_EVENT.selector()).withParameters(payload.getParameters()).build();
            diagnosticsOperationsService.vmDiagnosticsReport(resourceCrn, payload.getParameters());
            sendEvent(context, event);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Aggregations

CommonContext (com.sequenceiq.flow.core.CommonContext)84 Map (java.util.Map)83 Bean (org.springframework.context.annotation.Bean)83 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)46 DiagnosticsCollectionEvent (com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent)13 DiagnosticsCollectionEvent (com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionEvent)13 EnvironmentStatus (com.sequenceiq.environment.environment.EnvironmentStatus)12 EnvironmentDeletionDto (com.sequenceiq.environment.environment.dto.EnvironmentDeletionDto)12 EnvDeleteEvent (com.sequenceiq.environment.environment.flow.deletion.event.EnvDeleteEvent)12 ResourceEvent (com.sequenceiq.cloudbreak.event.ResourceEvent)11 EnvCreationEvent (com.sequenceiq.environment.environment.flow.creation.event.EnvCreationEvent)7 EnvCreationFailureEvent (com.sequenceiq.environment.environment.flow.creation.event.EnvCreationFailureEvent)7 CmDiagnosticsCollectionEvent (com.sequenceiq.cloudbreak.core.flow2.cmdiagnostics.event.CmDiagnosticsCollectionEvent)6 UpgradeCcmEvent (com.sequenceiq.environment.environment.flow.upgrade.ccm.event.UpgradeCcmEvent)6 ResourceCrnPayload (com.sequenceiq.cloudbreak.common.event.ResourceCrnPayload)5 Environment (com.sequenceiq.environment.environment.domain.Environment)4 EnvironmentStartDto (com.sequenceiq.environment.environment.dto.EnvironmentStartDto)4 EnvStartEvent (com.sequenceiq.environment.environment.flow.start.event.EnvStartEvent)4 DiagnosticParameters (com.sequenceiq.common.model.diagnostics.DiagnosticParameters)3 EnvStopEvent (com.sequenceiq.environment.environment.flow.stop.event.EnvStopEvent)3