use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class AbstractUpscaleAction method createFlowContext.
@Override
protected StackContext createFlowContext(FlowParameters flowParameters, StateContext<UpscaleState, UpscaleFlowEvent> stateContext, P payload) {
Stack stack = stackService.getByIdWithListsInTransaction(payload.getResourceId());
MDCBuilder.buildMdcContext(stack);
addMdcOperationIdIfPresent(stateContext.getExtendedState().getVariables());
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.flow.stack.StackContext in project cloudbreak by hortonworks.
the class FreeIpaUpscaleActions method freeIpaPostInstallAction.
@Bean(name = "UPSCALE_FREEIPA_POST_INSTALL_STATE")
public Action<?, ?> freeIpaPostInstallAction() {
return new AbstractUpscaleAction<>(ClusterProxyUpdateRegistrationSuccess.class) {
@Override
protected void doExecute(StackContext context, ClusterProxyUpdateRegistrationSuccess payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "FreeIPA Post Installation");
PostInstallFreeIpaRequest request = new PostInstallFreeIpaRequest(stack.getId(), false);
sendEvent(context, request.selector(), request);
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class FreeIpaUpscaleActions method upscaleFinsihedAction.
@Bean(name = "UPSCALE_FINISHED_STATE")
public Action<?, ?> upscaleFinsihedAction() {
return new AbstractUpscaleAction<>(StackEvent.class) {
@Inject
private OperationService operationService;
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getUpscaleCompleteStatus(variables), "Upscale complete");
if (shouldCompleteOperation(variables)) {
SuccessDetails successDetails = new SuccessDetails(stack.getEnvironmentCrn());
successDetails.getAdditionalDetails().put("Hosts", getUpscaleHosts(variables));
operationService.completeOperation(stack.getAccountId(), getOperationId(variables), List.of(successDetails), Collections.emptyList());
}
sendEvent(context, UPSCALE_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class FreeIpaUpscaleActions method installFreeIpaAction.
@Bean(name = "UPSCALE_FREEIPA_INSTALL_STATE")
public Action<?, ?> installFreeIpaAction() {
return new AbstractUpscaleAction<>(StackEvent.class) {
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Installing FreeIPA");
InstallFreeIpaServicesRequest request = new InstallFreeIpaServicesRequest(stack.getId());
sendEvent(context, request.selector(), request);
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackContext in project cloudbreak by hortonworks.
the class FreeIpaUpscaleActions method updateClusterProxyRegistrationAction.
@Bean(name = "UPSCALE_UPDATE_CLUSTERPROXY_REGISTRATION_STATE")
public Action<?, ?> updateClusterProxyRegistrationAction() {
return new AbstractUpscaleAction<>(InstallFreeIpaServicesSuccess.class) {
@Override
protected void doExecute(StackContext context, InstallFreeIpaServicesSuccess payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Update cluster proxy registration after bootstrap");
ClusterProxyUpdateRegistrationRequest request = new ClusterProxyUpdateRegistrationRequest(stack.getId());
sendEvent(context, request.selector(), request);
}
};
}
Aggregations