@Override protected Object execute(Event<StackScalingContext> event) throws CloudbreakException { LOGGER.info("execute() for phase: {}", event.getKey()); StackScalingContext stackScalingContext = event.getData(); if (isStackDownScale(stackScalingContext.getScalingType())) { FlowContext context = getFlowFacade().downscaleStack(stackScalingContext); LOGGER.info("Upscale of stack is finished. Context: {}", context); return context; } return stackScalingContext; }
@Override public void accept(Event<StartAmbariServicesRequest> event) { Long stackId = event.getData().getStackId(); Selectable response; try { clusterServiceRunner.runAmbariServices(stackId); response = new StartAmbariServicesSuccess(stackId); } catch (Exception e) { response = new StartAmbariServicesFailed(stackId, e); } eventBus.notify(response.selector(), new Event(event.getHeaders(), response)); }
@Override public void accept(Event<SetupRequest> event) { LOGGER.info("Received event: {}", event); SetupRequest request = event.getData(); CloudContext cloudContext = request.getCloudContext(); try { CloudConnector connector = cloudPlatformConnectors.get(cloudContext.getPlatformVariant()); AuthenticatedContext auth = connector.authentication().authenticate(cloudContext, request.getCloudCredential()); CloudStack cloudStack = request.getCloudStack(); connector.setup().prerequisites(auth, cloudStack, resourceNotifier); request.getResult().onNext(new SetupResult(request)); LOGGER.info("Provision setup finished for {}", cloudContext); } catch (Exception e) { request.getResult().onNext(new SetupResult(e, request)); } }