use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.dnssoarecords.UpdateDnsSoaRecordsResponse in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method removeHostsFromOrchestrationAction.
@Bean(name = "DOWNSCALE_REMOVE_HOSTS_FROM_ORCHESTRATION_STATE")
public Action<?, ?> removeHostsFromOrchestrationAction() {
return new AbstractDownscaleAction<>(UpdateDnsSoaRecordsResponse.class) {
@Override
protected void doExecute(StackContext context, UpdateDnsSoaRecordsResponse payload, Map<Object, Object> variables) {
stackUpdater.updateStackStatus(context.getStack().getId(), getInProgressStatus(variables), "Removing hosts from orchestration");
CleanupEvent cleanupEvent = buildCleanupEvent(context, getDownscaleHosts(variables));
RemoveHostsFromOrchestrationRequest request = new RemoveHostsFromOrchestrationRequest(cleanupEvent);
sendEvent(context, request);
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.dnssoarecords.UpdateDnsSoaRecordsResponse in project cloudbreak by hortonworks.
the class UpdateDnsSoaRecordsHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<UpdateDnsSoaRecordsRequest> event) {
UpdateDnsSoaRecordsRequest request = event.getData();
Selectable result;
try {
Long stackId = request.getResourceId();
Set<String> fqdns = request.getHosts().stream().map(hostname -> StringUtils.appendIfMissing(hostname, ".")).collect(Collectors.toSet());
updateSoaRecords(stackId, fqdns);
result = new UpdateDnsSoaRecordsResponse(request.getResourceId());
} catch (Exception e) {
LOGGER.error("Downscale updating DNS SOA records failed", e);
result = new DownscaleFailureEvent(DOWNSCALE_UPDATE_DNS_SOA_RECORDS_FAILED_EVENT.event(), request.getResourceId(), "Downscale Update DNS SOA Records", Set.of(), Map.of(), e);
}
return result;
}
Aggregations