use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class AbstractUserDataUpdateAction method createFlowContext.
@Override
protected StackContext createFlowContext(FlowParameters flowParameters, StateContext<UpdateUserDataState, UpdateUserDataEvents> stateContext, P payload) {
Stack stack = stackService.getByIdWithListsInTransaction(payload.getResourceId());
MDCBuilder.buildMdcContext(stack);
Location location = location(region(stack.getRegion()), availabilityZone(stack.getAvailabilityZone()));
CloudContext cloudContext = CloudContext.Builder.builder().withId(stack.getId()).withName(stack.getName()).withCrn(stack.getResourceCrn()).withPlatform(stack.getCloudPlatform()).withVariant(stack.getPlatformvariant()).withLocation(location).withUserName(stack.getOwner()).withAccountId(stack.getAccountId()).build();
CloudCredential cloudCredential = credentialConverter.convert(credentialService.getCredentialByEnvCrn(stack.getEnvironmentCrn()));
CloudStack cloudStack = cloudStackConverter.convert(stack);
return new StackContext(flowParameters, stack, cloudContext, cloudCredential, cloudStack);
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class MachineUserRemoveHandler method cleanupMachineUser.
private void cleanupMachineUser(Long stackId) {
Stack stack = stackService.getStackById(stackId);
Telemetry telemetry = stack.getTelemetry();
if (telemetry != null && (telemetry.isClusterLogsCollectionEnabled() || StringUtils.isNotBlank(stack.getDatabusCredential()))) {
ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> altusMachineUserService.cleanupMachineUser(stack, telemetry));
} else {
LOGGER.info("Machine user cleanup is not needed.");
}
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class TerminationService method requestDeletion.
public void requestDeletion(Long stackId, List<String> instanceIds) {
try {
transactionService.required(() -> {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
requestDeletionForInstances(stack, instanceIds);
});
} catch (TransactionExecutionException ex) {
LOGGER.info("Failed to request deletion for cluster infrastructure.");
throw new TerminationFailedException(ex);
}
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class TerminationService method finalizeTerminationForInstancesWithoutInstanceIds.
public void finalizeTerminationForInstancesWithoutInstanceIds(Long stackId) {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
terminateInstancesWithoutInstanceIds(stack);
}
use of com.sequenceiq.freeipa.entity.Stack in project cloudbreak by hortonworks.
the class FreeIpaScalingValidationServiceTest method testDownscaleIfInvalidInstancesExistsThenValidationFails.
@Test
public void testDownscaleIfInvalidInstancesExistsThenValidationFails() {
Stack stack = mock(Stack.class);
BadRequestException exception = assertThrows(BadRequestException.class, () -> underTest.validateStackForDownscale(createValidImSet(2), stack, null));
assertEquals("Downscaling currently only available for FreeIPA installation with 3 instances", exception.getMessage());
}
Aggregations