Search in sources :

Example 1 with UpscaleFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method updateEnvironmentStackConfigAction.

@Bean(name = "UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_STATE")
public Action<?, ?> updateEnvironmentStackConfigAction() {
    return new AbstractUpscaleAction<>(StackEvent.class) {

        @Inject
        private EnvironmentEndpoint environmentEndpoint;

        @Inject
        private WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor;

        @Override
        protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Updating environment stack config");
            try {
                ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> {
                    environmentEndpoint.updateConfigsInEnvironmentByCrn(stack.getEnvironmentCrn());
                });
                sendEvent(context, UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
            } catch (ClientErrorException e) {
                String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e);
                LOGGER.error("Failed to update the stack config due to {}", errorMessage, e);
                sendEvent(context, UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FAILED_EVENT.selector(), new UpscaleFailureEvent(stack.getId(), "Updating environment stack config", Set.of(), Map.of(), e));
            } catch (Exception e) {
                LOGGER.error("Failed to update the stack config", e);
                sendEvent(context, UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FAILED_EVENT.selector(), new UpscaleFailureEvent(stack.getId(), "Updating environment stack config", Set.of(), Map.of(), e));
            }
        }
    };
}
Also used : EnvironmentEndpoint(com.sequenceiq.environment.api.v1.environment.endpoint.EnvironmentEndpoint) StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) WebApplicationExceptionMessageExtractor(com.sequenceiq.cloudbreak.common.exception.WebApplicationExceptionMessageExtractor) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent) ClientErrorException(javax.ws.rs.ClientErrorException) Map(java.util.Map) ClientErrorException(javax.ws.rs.ClientErrorException) OperationException(com.sequenceiq.cloudbreak.service.OperationException) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Bean(org.springframework.context.annotation.Bean)

Example 2 with UpscaleFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method upscaleFailureAction.

@Bean(name = "UPSCALE_FAIL_STATE")
public Action<?, ?> upscaleFailureAction() {
    return new AbstractUpscaleAction<>(UpscaleFailureEvent.class) {

        @Inject
        private OperationService operationService;

        @Override
        protected StackContext createFlowContext(FlowParameters flowParameters, StateContext<UpscaleState, UpscaleFlowEvent> stateContext, UpscaleFailureEvent payload) {
            Flow flow = getFlow(flowParameters.getFlowId());
            flow.setFlowFailed(payload.getException());
            return super.createFlowContext(flowParameters, stateContext, payload);
        }

        @Override
        protected void doExecute(StackContext context, UpscaleFailureEvent payload, Map<Object, Object> variables) {
            LOGGER.error("Upscale failed with payload: " + payload);
            Stack stack = context.getStack();
            String environmentCrn = stack.getEnvironmentCrn();
            SuccessDetails successDetails = new SuccessDetails(environmentCrn);
            successDetails.getAdditionalDetails().put(payload.getFailedPhase(), payload.getSuccess() == null ? List.of() : new ArrayList<>(payload.getSuccess()));
            String message = "Upscale failed during " + payload.getFailedPhase();
            FailureDetails failureDetails = new FailureDetails(environmentCrn, message);
            if (payload.getFailureDetails() != null) {
                failureDetails.getAdditionalDetails().putAll(payload.getFailureDetails());
            }
            String errorReason = getErrorReason(payload.getException());
            stackUpdater.updateStackStatus(context.getStack().getId(), getFailedStatus(variables), errorReason);
            operationService.failOperation(stack.getAccountId(), getOperationId(variables), message, List.of(successDetails), List.of(failureDetails));
            enableStatusChecker(stack, "Failed upscaling FreeIPA");
            enableNodeStatusChecker(stack, "Failed upscaling FreeIPA");
            sendEvent(context, FAIL_HANDLED_EVENT.event(), payload);
        }

        @Override
        protected void initPayloadConverterMap(List<PayloadConverter<UpscaleFailureEvent>> payloadConverters) {
            payloadConverters.add(new UpscaleStackResultToUpscaleFailureEventConverter());
            payloadConverters.add(new CollectMetadataResultToUpscaleFailureEventConverter());
            payloadConverters.add(new BootstrapMachinesFailedToUpscaleFailureEventConverter());
            payloadConverters.add(new HostMetadataSetupFailedToUpscaleFailureEventConverter());
            payloadConverters.add(new InstallFreeIpaServicesFailedToUpscaleFailureEventConverter());
            payloadConverters.add(new ClusterProxyUpdateRegistrationFailedToUpscaleFailureEventConverter());
            payloadConverters.add(new PostInstallFreeIpaFailedToUpscaleFailureEventConverter());
        }
    };
}
Also used : SuccessDetails(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SuccessDetails) ClusterProxyUpdateRegistrationFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.ClusterProxyUpdateRegistrationFailedToUpscaleFailureEventConverter) StateContext(org.springframework.statemachine.StateContext) ArrayList(java.util.ArrayList) PostInstallFreeIpaFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.PostInstallFreeIpaFailedToUpscaleFailureEventConverter) BootstrapMachinesFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.BootstrapMachinesFailedToUpscaleFailureEventConverter) FailureDetails(com.sequenceiq.freeipa.api.v1.freeipa.user.model.FailureDetails) Flow(com.sequenceiq.flow.core.Flow) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) HostMetadataSetupFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.HostMetadataSetupFailedToUpscaleFailureEventConverter) FlowParameters(com.sequenceiq.flow.core.FlowParameters) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) UpscaleStackResultToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.UpscaleStackResultToUpscaleFailureEventConverter) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent) ArrayList(java.util.ArrayList) List(java.util.List) OperationService(com.sequenceiq.freeipa.service.operation.OperationService) InstallFreeIpaServicesFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.InstallFreeIpaServicesFailedToUpscaleFailureEventConverter) Map(java.util.Map) CollectMetadataResultToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.CollectMetadataResultToUpscaleFailureEventConverter) Bean(org.springframework.context.annotation.Bean)

Example 3 with UpscaleFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method updateKerberosNameserversConfigAction.

@Bean(name = "UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_STATE")
public Action<?, ?> updateKerberosNameserversConfigAction() {
    return new AbstractUpscaleAction<>(StackEvent.class) {

        @Inject
        private KerberosConfigUpdateService kerberosConfigUpdateService;

        @Override
        protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Updating kerberos nameserver config");
            try {
                kerberosConfigUpdateService.updateNameservers(stack.getId());
                sendEvent(context, UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
            } catch (Exception e) {
                LOGGER.error("Failed to update the kerberos nameserver config", e);
                sendEvent(context, UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FAILED_EVENT.selector(), new UpscaleFailureEvent(stack.getId(), "Updating kerberos nameserver config", Set.of(), Map.of(), e));
            }
        }
    };
}
Also used : StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent) KerberosConfigUpdateService(com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService) Map(java.util.Map) ClientErrorException(javax.ws.rs.ClientErrorException) OperationException(com.sequenceiq.cloudbreak.service.OperationException) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Bean(org.springframework.context.annotation.Bean)

Example 4 with UpscaleFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method validateInstancesAction.

@Bean(name = "UPSCALE_VALIDATE_INSTANCES_STATE")
public Action<?, ?> validateInstancesAction() {
    return new AbstractUpscaleAction<>(UpscaleStackResult.class) {

        @Override
        protected void doExecute(StackContext context, UpscaleStackResult payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Validating new instances");
            try {
                finishAddInstances(context, payload);
                sendEvent(context, UPSCALE_VALIDATE_INSTANCES_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
            } catch (Exception e) {
                LOGGER.error("Failed to validate the instances", e);
                sendEvent(context, UPSCALE_VALIDATE_INSTANCES_FAILED_EVENT.selector(), new UpscaleFailureEvent(stack.getId(), "Validating new instances", Set.of(), Map.of(), e));
            }
        }

        private void finishAddInstances(StackContext context, UpscaleStackResult payload) {
            LOGGER.debug("Upscale stack result: {}", payload);
            List<CloudResourceStatus> results = payload.getResults();
            validateResourceResults(context, payload.getErrorDetails(), results);
            Set<Resource> resourceSet = transformResults(results, context.getStack());
            if (resourceSet.isEmpty()) {
                metadataSetupService.cleanupRequestedInstances(context.getStack());
                throw new OperationException("Failed to upscale the cluster since all create request failed. Resource set is empty");
            }
            LOGGER.debug("Adding new instances to the stack is DONE");
        }

        private void validateResourceResults(StackContext context, Exception exception, List<CloudResourceStatus> results) {
            if (exception != null) {
                LOGGER.info(format("Failed to upscale stack: %s", context.getCloudContext()), exception);
                throw new OperationException(exception);
            }
            List<CloudResourceStatus> missingResources = results.stream().filter(result -> CommonResourceType.TEMPLATE == result.getCloudResource().getType().getCommonResourceType()).filter(status -> status.isFailed() || status.isDeleted()).collect(Collectors.toList());
            if (!missingResources.isEmpty()) {
                StringBuilder message = new StringBuilder("Failed to upscale the stack for ").append(context.getCloudContext()).append(" due to: ");
                missingResources.forEach(res -> message.append("[privateId: ").append(res.getPrivateId()).append(", statusReason: ").append(res.getStatusReason()).append("] "));
                LOGGER.warn(message.toString());
                throw new OperationException(message.toString());
            }
        }

        private Set<Resource> transformResults(Iterable<CloudResourceStatus> cloudResourceStatuses, Stack stack) {
            Set<Resource> retSet = new HashSet<>();
            for (CloudResourceStatus cloudResourceStatus : cloudResourceStatuses) {
                if (!cloudResourceStatus.isFailed()) {
                    CloudResource cloudResource = cloudResourceStatus.getCloudResource();
                    Resource resource = new Resource(cloudResource.getType(), cloudResource.getName(), cloudResource.getReference(), cloudResource.getStatus(), stack, null, cloudResource.getAvailabilityZone());
                    retSet.add(resource);
                }
            }
            return retSet;
        }
    };
}
Also used : StringUtils(org.apache.commons.lang3.StringUtils) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) Map(java.util.Map) UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FINISHED_EVENT) CloudVmInstanceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus) EnvironmentEndpoint(com.sequenceiq.environment.api.v1.environment.endpoint.EnvironmentEndpoint) PayloadConverter(com.sequenceiq.flow.core.PayloadConverter) UPSCALE_RECORD_HOSTNAMES_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_RECORD_HOSTNAMES_FINISHED_EVENT) CloudResourceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudResourceStatus) FailureDetails(com.sequenceiq.freeipa.api.v1.freeipa.user.model.FailureDetails) Set(java.util.Set) WebApplicationExceptionMessageExtractor(com.sequenceiq.cloudbreak.common.exception.WebApplicationExceptionMessageExtractor) AdjustmentType(com.sequenceiq.common.api.type.AdjustmentType) UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FAILED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_UPDATE_ENVIRONMENT_STACK_CONFIG_FAILED_EVENT) ValidateCloudStorageRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.cloudstorage.ValidateCloudStorageRequest) Flow(com.sequenceiq.flow.core.Flow) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) KerberosConfigUpdateService(com.sequenceiq.freeipa.service.config.KerberosConfigUpdateService) InstanceGroupService(com.sequenceiq.freeipa.service.stack.instance.InstanceGroupService) UPSCALE_VALIDATE_INSTANCES_FAILED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_VALIDATE_INSTANCES_FAILED_EVENT) UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FAILED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FAILED_EVENT) ResourceLists(com.sequenceiq.cloudbreak.cloud.transform.ResourceLists) BootstrapMachinesRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_UPDATE_KERBEROS_NAMESERVERS_CONFIG_FINISHED_EVENT) UPSCALE_UPDATE_METADATA_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_UPDATE_METADATA_FINISHED_EVENT) ResourceToCloudResourceConverter(com.sequenceiq.freeipa.converter.cloud.ResourceToCloudResourceConverter) ArrayList(java.util.ArrayList) StateContext(org.springframework.statemachine.StateContext) InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) ClusterProxyRegistrationSuccess(com.sequenceiq.freeipa.flow.stack.provision.event.clusterproxy.ClusterProxyRegistrationSuccess) CommonResourceType(com.sequenceiq.common.api.type.CommonResourceType) PostInstallFreeIpaRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaRequest) UPSCALE_SAVE_METADATA_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_SAVE_METADATA_FINISHED_EVENT) PostInstallFreeIpaSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaSuccess) PostInstallFreeIpaFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.PostInstallFreeIpaFailedToUpscaleFailureEventConverter) InstanceStatus(com.sequenceiq.cloudbreak.cloud.model.InstanceStatus) StackToCloudStackConverter(com.sequenceiq.freeipa.converter.cloud.StackToCloudStackConverter) InstallFreeIpaServicesSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.services.InstallFreeIpaServicesSuccess) SuccessDetails(com.sequenceiq.freeipa.api.v1.freeipa.user.model.SuccessDetails) Action(org.springframework.statemachine.action.Action) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) LoggerFactory(org.slf4j.LoggerFactory) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) ClientErrorException(javax.ws.rs.ClientErrorException) OrchestratorConfigRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.orchestrator.OrchestratorConfigRequest) ResourceService(com.sequenceiq.freeipa.service.resource.ResourceService) UpscaleStackRequest(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleStackRequest) UpscaleEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleEvent) UPSCALE_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_FINISHED_EVENT) HostMetadataSetupRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.hostmetadatasetup.HostMetadataSetupRequest) CollectMetadataResultToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.CollectMetadataResultToUpscaleFailureEventConverter) ClusterProxyUpdateRegistrationRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.clusterproxy.ClusterProxyUpdateRegistrationRequest) UPSCALE_STARTING_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_STARTING_FINISHED_EVENT) ResourceStatus(com.sequenceiq.cloudbreak.cloud.model.ResourceStatus) InstanceMetaDataService(com.sequenceiq.freeipa.service.stack.instance.InstanceMetaDataService) TlsSetupService(com.sequenceiq.freeipa.service.TlsSetupService) FlowParameters(com.sequenceiq.flow.core.FlowParameters) ClusterProxyRegistrationRequest(com.sequenceiq.freeipa.flow.stack.provision.event.clusterproxy.ClusterProxyRegistrationRequest) UpscaleStackResultToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.UpscaleStackResultToUpscaleFailureEventConverter) InstallFreeIpaServicesRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.services.InstallFreeIpaServicesRequest) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) FAIL_HANDLED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.FAIL_HANDLED_EVENT) Objects(java.util.Objects) Configuration(org.springframework.context.annotation.Configuration) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) List(java.util.List) HostMetadataSetupFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.HostMetadataSetupFailedToUpscaleFailureEventConverter) StackUpdater(com.sequenceiq.freeipa.service.stack.StackUpdater) BootstrapMachinesFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.BootstrapMachinesFailedToUpscaleFailureEventConverter) UpscaleStackResult(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleStackResult) HashSet(java.util.HashSet) Inject(javax.inject.Inject) BootstrapMachinesSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesSuccess) InstallFreeIpaServicesFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.InstallFreeIpaServicesFailedToUpscaleFailureEventConverter) Resource(com.sequenceiq.freeipa.entity.Resource) Logger(org.slf4j.Logger) UpscaleFlowEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent) ValidateInstancesHealthEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.ValidateInstancesHealthEvent) CollectMetadataResult(com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataResult) CollectMetadataRequest(com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataRequest) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) AdjustmentTypeWithThreshold(com.sequenceiq.common.api.adjustment.AdjustmentTypeWithThreshold) ClusterProxyUpdateRegistrationSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.clusterproxy.ClusterProxyUpdateRegistrationSuccess) ClusterProxyUpdateRegistrationFailedToUpscaleFailureEventConverter(com.sequenceiq.freeipa.flow.freeipa.upscale.failure.ClusterProxyUpdateRegistrationFailedToUpscaleFailureEventConverter) OperationService(com.sequenceiq.freeipa.service.operation.OperationService) OperationException(com.sequenceiq.cloudbreak.service.OperationException) MetadataSetupService(com.sequenceiq.freeipa.service.stack.instance.MetadataSetupService) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) HostMetadataSetupSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.hostmetadatasetup.HostMetadataSetupSuccess) UPSCALE_VALIDATE_INSTANCES_FINISHED_EVENT(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleFlowEvent.UPSCALE_VALIDATE_INSTANCES_FINISHED_EVENT) Bean(org.springframework.context.annotation.Bean) Collections(java.util.Collections) UpscaleState(com.sequenceiq.freeipa.flow.freeipa.upscale.UpscaleState) Resource(com.sequenceiq.freeipa.entity.Resource) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) ClientErrorException(javax.ws.rs.ClientErrorException) OperationException(com.sequenceiq.cloudbreak.service.OperationException) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) UpscaleStackResult(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleStackResult) StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) CloudResourceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudResourceStatus) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent) ArrayList(java.util.ArrayList) List(java.util.List) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) Map(java.util.Map) OperationException(com.sequenceiq.cloudbreak.service.OperationException) HashSet(java.util.HashSet) Bean(org.springframework.context.annotation.Bean)

Example 5 with UpscaleFailureEvent

use of com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent in project cloudbreak by hortonworks.

the class ClusterProxyUpdateRegistrationFailedToUpscaleFailureEventConverter method convert.

@Override
public UpscaleFailureEvent convert(Object payload) {
    ClusterProxyUpdateRegistrationFailed result = (ClusterProxyUpdateRegistrationFailed) payload;
    UpscaleFailureEvent event = new UpscaleFailureEvent(result.getResourceId(), "Updating cluster proxy", Set.of(), Map.of(), new Exception("Payload failed: " + payload));
    return event;
}
Also used : ClusterProxyUpdateRegistrationFailed(com.sequenceiq.freeipa.flow.freeipa.provision.event.clusterproxy.ClusterProxyUpdateRegistrationFailed) UpscaleFailureEvent(com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent)

Aggregations

UpscaleFailureEvent (com.sequenceiq.freeipa.flow.freeipa.upscale.event.UpscaleFailureEvent)16 Stack (com.sequenceiq.freeipa.entity.Stack)7 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)5 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)5 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)5 Map (java.util.Map)5 Bean (org.springframework.context.annotation.Bean)5 OperationException (com.sequenceiq.cloudbreak.service.OperationException)4 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)4 ValidateInstancesHealthEvent (com.sequenceiq.freeipa.flow.freeipa.upscale.event.ValidateInstancesHealthEvent)4 ClientErrorException (javax.ws.rs.ClientErrorException)4 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)3 CollectMetadataResult (com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataResult)2 WebApplicationExceptionMessageExtractor (com.sequenceiq.cloudbreak.common.exception.WebApplicationExceptionMessageExtractor)2 EnvironmentEndpoint (com.sequenceiq.environment.api.v1.environment.endpoint.EnvironmentEndpoint)2 Flow (com.sequenceiq.flow.core.Flow)2 FlowParameters (com.sequenceiq.flow.core.FlowParameters)2 HandlerEvent (com.sequenceiq.flow.reactor.api.handler.HandlerEvent)2 FailureDetails (com.sequenceiq.freeipa.api.v1.freeipa.user.model.FailureDetails)2 SuccessDetails (com.sequenceiq.freeipa.api.v1.freeipa.user.model.SuccessDetails)2