use of com.sequenceiq.freeipa.flow.freeipa.provision.event.hostmetadatasetup.HostMetadataSetupSuccess in project cloudbreak by hortonworks.
the class FreeIpaUpscaleActions method recordHostnamesAction.
@Bean(name = "UPSCALE_RECORD_HOSTNAMES_STATE")
public Action<?, ?> recordHostnamesAction() {
return new AbstractUpscaleAction<>(HostMetadataSetupSuccess.class) {
@Override
protected void doExecute(StackContext context, HostMetadataSetupSuccess payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Recording hostnames");
List<String> instanceIds = getInstanceIds(variables);
List<String> hosts = stack.getNotDeletedInstanceMetaDataList().stream().filter(instanceMetaData -> instanceIds.contains(instanceMetaData.getInstanceId())).map(InstanceMetaData::getDiscoveryFQDN).collect(Collectors.toList());
setUpscaleHosts(variables, hosts);
sendEvent(context, UPSCALE_RECORD_HOSTNAMES_FINISHED_EVENT.selector(), new StackEvent(stack.getId()));
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.provision.event.hostmetadatasetup.HostMetadataSetupSuccess 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));
}
Aggregations