Search in sources :

Example 1 with CommonContext

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);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 2 with CommonContext

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);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 3 with CommonContext

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);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 4 with CommonContext

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);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 5 with CommonContext

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);
        }
    };
}
Also used : CommonContext(com.sequenceiq.flow.core.CommonContext) DiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.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