use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayActions method startingAction.
@Bean(name = "CHANGE_PRIMARY_GATEWAY_STATE_STARTING")
public Action<?, ?> startingAction() {
return new AbstractChangePrimaryGatewayAction<>(ChangePrimaryGatewayEvent.class) {
@Override
protected void doExecute(ChangePrimaryGatewayContext context, ChangePrimaryGatewayEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
String operationId = payload.getOperationId();
setOperationId(variables, operationId);
setInstanceIds(variables, payload.getRepairInstaceIds());
setFinalChain(variables, payload.isFinalChain());
LOGGER.info("Starting to change the primary gateway {}", payload);
stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.REPAIR_IN_PROGRESS, "Starting to change the primary gateway");
sendEvent(context, CHANGE_PRIMARY_GATEWAY_STARTING_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
}
};
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class SelectionHandler method accept.
@Override
public void accept(Event<ChangePrimaryGatewaySelectionRequest> changePrimaryGatewaySelectionRequestEvent) {
ChangePrimaryGatewaySelectionRequest request = changePrimaryGatewaySelectionRequestEvent.getData();
Selectable result;
try {
Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId());
Optional<String> formerPrimaryGatewayInstanceId = changePrimaryGatewayService.getPrimaryGatewayInstanceId(stack);
String newPrimaryGatewayInstanceId = changePrimaryGatewayService.selectNewPrimaryGatewayInstanceId(stack, request.getRepairInstanceIds());
result = new ChangePrimaryGatewaySelectionSuccess(request.getResourceId(), formerPrimaryGatewayInstanceId, newPrimaryGatewayInstanceId);
} catch (Exception e) {
LOGGER.error("Failed to select the new primary gateway", e);
result = new ChangePrimaryGatewayFailureEvent(request.getResourceId(), "Selecting primary gateway", Set.of(), Map.of(), e);
}
eventBus.notify(result.selector(), new Event<>(changePrimaryGatewaySelectionRequestEvent.getHeaders(), result));
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class StackStatusTest method setUp.
void setUp(int instanceCount) throws Exception {
underTest.setLocalId(STACK_ID.toString());
stack = new Stack();
stack.setId(STACK_ID);
StackStatus stackStatus = new StackStatus();
stackStatus.setDetailedStackStatus(DetailedStackStatus.PROVISIONED);
stack.setStackStatus(stackStatus);
when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenReturn(stack);
when(flowLogService.isOtherFlowRunning(STACK_ID)).thenReturn(false);
InstanceGroup instanceGroup1 = new InstanceGroup();
Set<InstanceMetaData> instances = new HashSet<>();
if (instanceCount >= 1) {
instances.add(createInstance(INSTANCE_1));
}
if (instanceCount >= 2) {
instances.add(createInstance(INSTANCE_2));
}
if (instanceCount >= 3) {
instances.add(createInstance(INSTANCE_3));
}
instanceGroup1.setInstanceMetaData(instances);
stack.setInstanceGroups(Set.of(instanceGroup1));
notTerminatedInstances = instances;
when(instanceMetaDataService.findNotTerminatedForStack(STACK_ID)).thenReturn(notTerminatedInstances);
rpcResponse = new RPCResponse<>();
when(freeIpaInstanceHealthDetailsService.checkFreeIpaHealth(eq(stack), any())).thenReturn(rpcResponse);
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class AvailabilityCheckerTest method testAvailable.
@Test
public void testAvailable() {
Stack stack = new Stack();
stack.setAppVersion("2.20.0-rc.1");
assertTrue(underTest.isAvailable(stack, afterVersion1));
stack.setAppVersion("2.21.0-rc.1");
assertTrue(underTest.isAvailable(stack, afterVersion1));
stack.setAppVersion("2.20.0");
assertTrue(underTest.isAvailable(stack, afterVersion1));
stack.setAppVersion("2.20.0-dev.2");
assertTrue(underTest.isAvailable(stack, afterVersion1));
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class HealthCheckAvailabilityCheckerTest method testAvailable.
@Test
public void testAvailable() {
Stack stack = new Stack();
stack.setAppVersion(AVAILABLE_VERSION);
stack.setAccountId(ACCOUNT_ID);
assertTrue(underTest.isCdpFreeIpaHeathAgentAvailable(stack));
}
Aggregations