use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackCreationActions method getTlsInfoAction.
@Bean(name = "GET_TLS_INFO_STATE")
public Action<?, ?> getTlsInfoAction() {
return new AbstractStackCreationAction<GetTlsInfoResult>(GetTlsInfoResult.class) {
@Override
protected void doExecute(StackContext context, GetTlsInfoResult payload, Map<Object, Object> variables) {
Stack stack = stackCreationService.saveTlsInfo(context, payload.getTlsInfo());
StackContext newContext = new StackContext(context.getFlowId(), stack, context.getCloudContext(), context.getCloudCredential(), context.getCloudStack());
sendEvent(newContext);
}
@Override
protected Selectable createRequest(StackContext context) {
InstanceMetaData gatewayMetaData = context.getStack().getPrimaryGatewayInstance();
CloudInstance gatewayInstance = metadataConverter.convert(gatewayMetaData);
return new GetSSHFingerprintsRequest<GetSSHFingerprintsResult>(context.getCloudContext(), context.getCloudCredential(), gatewayInstance);
}
};
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackCreationService method saveTlsInfo.
public Stack saveTlsInfo(StackContext context, TlsInfo tlsInfo) {
boolean usePrivateIpToTls = tlsInfo.usePrivateIpToTls();
Stack stack = context.getStack();
if (usePrivateIpToTls) {
SecurityConfig securityConfig = stack.getSecurityConfig();
securityConfig.setUsePrivateIpToTls(usePrivateIpToTls);
stackUpdater.updateStackSecurityConfig(stack, securityConfig);
stack = stackService.getByIdWithLists(stack.getId());
LOGGER.info("Update Stack and it's SecurityConfig to use private ip when TLS is built.");
}
return stack;
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackCreationService method checkImage.
public CheckImageResult checkImage(StackContext context) {
try {
Stack stack = context.getStack();
Image image = imageService.getImage(stack.getId());
CheckImageRequest<CheckImageResult> checkImageRequest = new CheckImageRequest<>(context.getCloudContext(), context.getCloudCredential(), cloudStackConverter.convert(stack), image);
LOGGER.info("Triggering event: {}", checkImageRequest);
eventBus.notify(checkImageRequest.selector(), eventFactory.createEvent(checkImageRequest));
CheckImageResult result = checkImageRequest.await();
sendNotification(result, stack);
LOGGER.info("Result: {}", result);
return result;
} catch (InterruptedException e) {
LOGGER.error("Error while executing check image", e);
throw new OperationException(e);
} catch (CloudbreakImageNotFoundException e) {
throw new CloudbreakServiceException(e);
}
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class DisableOnGCPRestartAction method restart.
@Override
public void restart(String flowId, String flowChainId, String event, Object payload) {
Payload stackPayload = (Payload) payload;
Stack stack = stackService.getById(stackPayload.getStackId());
if (stack.getPlatformVariant().equals(GCP)) {
flowLogService.terminate(stackPayload.getStackId(), flowId);
} else {
restart(flowId, flowChainId, event, payload, stack);
}
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class FillInMemoryStateStoreRestartAction method restart.
@Override
public void restart(String flowId, String flowChainId, String event, Object payload) {
Payload stackPayload = (Payload) payload;
Stack stack = stackService.getByIdWithLists(stackPayload.getStackId());
restart(flowId, flowChainId, event, payload, stack);
}
Aggregations