Search in sources :

Example 1 with BootstrapMachinesRequest

use of com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesRequest in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method bootstrappingMachinesAction.

@Bean(name = "UPSCALE_BOOTSTRAPPING_MACHINES_STATE")
public Action<?, ?> bootstrappingMachinesAction() {
    return new AbstractUpscaleAction<>(ClusterProxyRegistrationSuccess.class) {

        @Override
        protected void doExecute(StackContext context, ClusterProxyRegistrationSuccess payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Bootstrapping machines");
            BootstrapMachinesRequest request = new BootstrapMachinesRequest(stack.getId());
            sendEvent(context, request.selector(), request);
        }
    };
}
Also used : StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) ClusterProxyRegistrationSuccess(com.sequenceiq.freeipa.flow.stack.provision.event.clusterproxy.ClusterProxyRegistrationSuccess) BootstrapMachinesRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesRequest) Map(java.util.Map) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) Bean(org.springframework.context.annotation.Bean)

Example 2 with BootstrapMachinesRequest

use of com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesRequest in project cloudbreak by hortonworks.

the class BootstrapMachineHandler method accept.

@Override
public void accept(Event<BootstrapMachinesRequest> event) {
    BootstrapMachinesRequest request = event.getData();
    Selectable response;
    try {
        bootstrapService.bootstrap(request.getResourceId());
        response = new BootstrapMachinesSuccess(request.getResourceId());
    } catch (Exception e) {
        LOGGER.error("Bootstrap failed", e);
        response = new BootstrapMachinesFailed(request.getResourceId(), e);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : BootstrapMachinesFailed(com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesFailed) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) BootstrapMachinesSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesSuccess) BootstrapMachinesRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesRequest)

Aggregations

BootstrapMachinesRequest (com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesRequest)2 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 BootstrapMachinesFailed (com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesFailed)1 BootstrapMachinesSuccess (com.sequenceiq.freeipa.flow.freeipa.provision.event.bootstrap.BootstrapMachinesSuccess)1 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)1 ClusterProxyRegistrationSuccess (com.sequenceiq.freeipa.flow.stack.provision.event.clusterproxy.ClusterProxyRegistrationSuccess)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1