use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvClustersDeleteActions method datahubClustersDeleteAction.
@Bean(name = "DATAHUB_CLUSTERS_DELETE_STARTED_STATE")
public Action<?, ?> datahubClustersDeleteAction() {
return new AbstractEnvClustersDeleteAction<>(EnvDeleteEvent.class) {
@Override
protected void doExecute(CommonContext context, EnvDeleteEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.DATAHUB_CLUSTERS_DELETE_IN_PROGRESS;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_DATAHUB_CLUSTERS_DELETION_STARTED;
EnvClustersDeleteState envClustersDeleteState = EnvClustersDeleteState.DATAHUB_CLUSTERS_DELETE_STARTED_STATE;
String logDeleteState = "Data Hub clusters";
EnvironmentDeletionDto envDto = commonUpdateEnvironmentAndNotify(context, payload, environmentStatus, resourceEvent, envClustersDeleteState, logDeleteState);
sendEvent(context, DELETE_DATAHUB_CLUSTERS_EVENT.selector(), envDto);
}
};
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class EnvironmentSyncServiceTest method testGetStatusByFreeipaWhenFreeipaNotAttached.
@Test
void testGetStatusByFreeipaWhenFreeipaNotAttached() {
Environment environment = new Environment();
environment.setResourceCrn("crn");
environment.setCreateFreeIpa(false);
when(freeIpaService.internalDescribe(environment.getResourceCrn(), "cloudera")).thenReturn(Optional.empty());
EnvironmentStatus actual = underTest.getStatusByFreeipa(environment);
Assertions.assertEquals(EnvironmentStatus.AVAILABLE, actual);
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class LoadBalancerUpdateActions method stackLoadBalancerUpdate.
@Bean(name = "STACK_UPDATE_STATE")
public Action<?, ?> stackLoadBalancerUpdate() {
return new AbstractLoadBalancerUpdateAction<>(LoadBalancerUpdateEvent.class) {
@Override
protected void doExecute(CommonContext context, LoadBalancerUpdateEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.LOAD_BALANCER_STACK_UPDATE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_LOAD_BALANCER_STACK_UPDATE_STARTED;
LoadBalancerUpdateState loadBalancerUpdateState = LoadBalancerUpdateState.STACK_UPDATE_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, loadBalancerUpdateState);
EnvironmentLoadBalancerDto environmentLoadBalancerDto = EnvironmentLoadBalancerDto.builder().withId(envDto.getId()).withEnvironmentDto(payload.getEnvironmentDto()).withEndpointAccessGateway(payload.getEndpointAccessGateway()).withEndpointGatewaySubnetIds(payload.getSubnetIds()).build();
sendEvent(context, LoadBalancerUpdateHandlerSelectors.STACK_UPDATE_HANDLER_EVENT.selector(), environmentLoadBalancerDto);
}
};
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class LoadBalancerUpdateActions method environmentLoadBalancerUpdate.
@Bean(name = "ENVIRONMENT_UPDATE_STATE")
public Action<?, ?> environmentLoadBalancerUpdate() {
return new AbstractLoadBalancerUpdateAction<>(LoadBalancerUpdateEvent.class) {
@Override
protected void doExecute(CommonContext context, LoadBalancerUpdateEvent payload, Map<Object, Object> variables) {
EnvironmentStatus environmentStatus = EnvironmentStatus.LOAD_BALANCER_ENV_UPDATE_STARTED;
ResourceEvent resourceEvent = ResourceEvent.ENVIRONMENT_LOAD_BALANCER_ENV_UPDATE_STARTED;
LoadBalancerUpdateState loadBalancerUpdateState = LoadBalancerUpdateState.ENVIRONMENT_UPDATE_STATE;
EnvironmentDto envDto = environmentStatusUpdateService.updateEnvironmentStatusAndNotify(context, payload, environmentStatus, resourceEvent, loadBalancerUpdateState);
EnvironmentLoadBalancerDto environmentLoadBalancerDto = EnvironmentLoadBalancerDto.builder().withId(envDto.getId()).withEnvironmentDto(payload.getEnvironmentDto()).withEndpointAccessGateway(payload.getEndpointAccessGateway()).withEndpointGatewaySubnetIds(payload.getSubnetIds()).build();
sendEvent(context, LoadBalancerUpdateHandlerSelectors.ENVIRONMENT_UPDATE_HANDLER_EVENT.selector(), environmentLoadBalancerDto);
}
};
}
use of com.sequenceiq.environment.environment.EnvironmentStatus in project cloudbreak by hortonworks.
the class UpgradeCcmActions method failedAction.
@Bean(name = "UPGRADE_CCM_FAILED_STATE")
public Action<?, ?> failedAction() {
return new AbstractUpgradeCcmAction<>(UpgradeCcmFailedEvent.class) {
@Override
protected void doExecute(CommonContext context, UpgradeCcmFailedEvent payload, Map<Object, Object> variables) {
LOGGER.error(String.format("Failed to upgrade CCM in environment '%s'. Status: '%s'.", payload.getEnvironmentDto(), payload.getEnvironmentStatus()), payload.getException());
EnvironmentDto environmentDto = environmentStatusUpdateService.updateFailedEnvironmentStatusAndNotify(context, payload, payload.getEnvironmentStatus(), convertStatus(payload.getEnvironmentStatus()), UpgradeCcmState.UPGRADE_CCM_FAILED_STATE);
metricService.incrementMetricCounter(MetricType.ENV_UPGRADE_CCM_FAILED, environmentDto, payload.getException());
sendEvent(context, HANDLED_FAILED_UPGRADE_CCM_EVENT.event(), payload);
}
private ResourceEvent convertStatus(EnvironmentStatus status) {
switch(status) {
case UPGRADE_CCM_VALIDATION_FAILED:
return ResourceEvent.ENVIRONMENT_UPGRADE_CCM_VALIDATION_FAILED;
case UPGRADE_CCM_TUNNEL_UPDATE_FAILED:
return ResourceEvent.ENVIRONMENT_UPGRADE_CCM_TUNNEL_UPDATE_FAILED;
case UPGRADE_CCM_ON_FREEIPA_FAILED:
return ResourceEvent.ENVIRONMENT_UPGRADE_CCM_ON_FREEIPA_FAILED;
case UPGRADE_CCM_ON_DATALAKE_FAILED:
return ResourceEvent.ENVIRONMENT_UPGRADE_CCM_ON_DATALAKE_FAILED;
case UPGRADE_CCM_ON_DATAHUB_FAILED:
return ResourceEvent.ENVIRONMENT_UPGRADE_CCM_ON_DATAHUB_FAILED;
default:
return ResourceEvent.ENVIRONMENT_UPGRADE_CCM_FAILED;
}
}
};
}
Aggregations