use of com.sequenceiq.freeipa.flow.stack.StackEvent in project cloudbreak by hortonworks.
the class HostMetadataSetupHandler method accept.
@Override
public void accept(Event<HostMetadataSetupRequest> event) {
StackEvent request = event.getData();
LOGGER.debug("Host metadata setup request {}", request);
Selectable response;
try {
hostMetadataSetup.setupHostMetadata(request.getResourceId());
response = new HostMetadataSetupSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.debug("Host metadata setup failed", e);
response = new HostMetadataSetupFailed(request.getResourceId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.freeipa.flow.stack.StackEvent in project cloudbreak by hortonworks.
the class InstallFreeIpaServicesHandler method accept.
@Override
public void accept(Event<InstallFreeIpaServicesRequest> event) {
StackEvent request = event.getData();
Selectable response;
try {
freeIpaInstallService.installFreeIpa(request.getResourceId());
response = new InstallFreeIpaServicesSuccess(request.getResourceId());
} catch (Exception e) {
LOGGER.error("FreeIPA service install failed", e);
response = new InstallFreeIpaServicesFailed(request.getResourceId(), e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.freeipa.flow.stack.StackEvent in project cloudbreak by hortonworks.
the class ChangePrimaryGatewayActions method startingAction.
@Bean(name = "CHANGE_PRIMARY_GATEWAY_STATE_STARTING")
public Action<?, ?> startingAction() {
return new AbstractChangePrimaryGatewayAction<>(ChangePrimaryGatewayEvent.class) {
@Override
protected void doExecute(ChangePrimaryGatewayContext context, ChangePrimaryGatewayEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
String operationId = payload.getOperationId();
setOperationId(variables, operationId);
setInstanceIds(variables, payload.getRepairInstaceIds());
setFinalChain(variables, payload.isFinalChain());
LOGGER.info("Starting to change the primary gateway {}", payload);
stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.REPAIR_IN_PROGRESS, "Starting to change the primary gateway");
sendEvent(context, CHANGE_PRIMARY_GATEWAY_STARTING_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackEvent in project cloudbreak by hortonworks.
the class UpgradeCcmActions method finished.
@Bean(name = UPGRADE_CCM_FINISHED_STATE_NAME)
public Action<?, ?> finished() {
return new AbstractUpgradeCcmEventAction() {
@Override
protected void doExecute(UpgradeCcmContext context, UpgradeCcmEvent payload, Map<Object, Object> variables) {
LOGGER.info("FreeIPA CCM upgrade finished {}", payload);
upgradeCcmService.finishedState(context.getStack().getId());
completeOperation(context.getStack().getAccountId(), context.getStack().getEnvironmentCrn(), variables);
sendEvent(context, UPGRADE_CCM_FINISHED_EVENT.event(), new StackEvent(context.getStack().getId()));
}
};
}
use of com.sequenceiq.freeipa.flow.stack.StackEvent in project cloudbreak by hortonworks.
the class ProvisionFlowEventChainFactory method createFlowTriggerEventQueue.
@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(StackEvent event) {
Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
flowEventChain.add(new StackEvent(StackProvisionEvent.START_CREATION_EVENT.event(), event.getResourceId(), event.accepted()));
flowEventChain.add(new StackEvent(FreeIpaProvisionEvent.FREEIPA_PROVISION_EVENT.event(), event.getResourceId()));
return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Aggregations