Search in sources :

Example 1 with PostInstallFreeIpaSuccess

use of com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaSuccess in project cloudbreak by hortonworks.

the class FreeIpaUpscaleActions method updateMetadataAction.

@Bean(name = "UPSCALE_UPDATE_METADATA_STATE")
public Action<?, ?> updateMetadataAction() {
    return new AbstractUpscaleAction<>(PostInstallFreeIpaSuccess.class) {

        @Override
        protected void doExecute(StackContext context, PostInstallFreeIpaSuccess payload, Map<Object, Object> variables) {
            Stack stack = context.getStack();
            stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Upscale update metadata");
            if (!isRepair(variables)) {
                int nodeCount = getInstanceCountByGroup(variables);
                for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
                    instanceGroup.setNodeCount(nodeCount);
                    instanceGroupService.save(instanceGroup);
                }
            }
            sendEvent(context, UPSCALE_UPDATE_METADATA_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
        }
    };
}
Also used : StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) StackContext(com.sequenceiq.freeipa.flow.stack.StackContext) PostInstallFreeIpaSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaSuccess) Map(java.util.Map) EnvironmentEndpoint(com.sequenceiq.environment.api.v1.environment.endpoint.EnvironmentEndpoint) Stack(com.sequenceiq.freeipa.entity.Stack) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) Bean(org.springframework.context.annotation.Bean)

Example 2 with PostInstallFreeIpaSuccess

use of com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaSuccess in project cloudbreak by hortonworks.

the class PostInstallFreeIpaHandler method accept.

@Override
public void accept(Event<PostInstallFreeIpaRequest> event) {
    PostInstallFreeIpaRequest request = event.getData();
    Selectable response;
    try {
        freeIpaPostInstallService.postInstallFreeIpa(request.getResourceId(), request.isFullPostInstall());
        response = new PostInstallFreeIpaSuccess(request.getResourceId());
    } catch (Exception e) {
        LOGGER.error("Post install tasks have failed", e);
        response = new PostInstallFreeIpaFailed(request.getResourceId(), e);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PostInstallFreeIpaFailed(com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaFailed) PostInstallFreeIpaSuccess(com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaSuccess) PostInstallFreeIpaRequest(com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaRequest)

Aggregations

PostInstallFreeIpaSuccess (com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaSuccess)2 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 EnvironmentEndpoint (com.sequenceiq.environment.api.v1.environment.endpoint.EnvironmentEndpoint)1 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)1 Stack (com.sequenceiq.freeipa.entity.Stack)1 PostInstallFreeIpaFailed (com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaFailed)1 PostInstallFreeIpaRequest (com.sequenceiq.freeipa.flow.freeipa.provision.event.postinstall.PostInstallFreeIpaRequest)1 StackContext (com.sequenceiq.freeipa.flow.stack.StackContext)1 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)1 Map (java.util.Map)1 Bean (org.springframework.context.annotation.Bean)1