use of com.sequenceiq.cloudbreak.domain.stack.DnsResolverType in project cloudbreak by hortonworks.
the class UpdateDomainDnsResolverHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<UpdateDomainDnsResolverRequest> updateDomainDnsResolverRequestHandlerEvent) {
UpdateDomainDnsResolverRequest event = updateDomainDnsResolverRequestHandlerEvent.getData();
try {
Stack stack = stackService.getByIdWithLists(event.getResourceId());
DnsResolverType actualDnsResolverType = targetedUpscaleSupportService.getActualDnsResolverType(stack);
if (!actualDnsResolverType.equals(stack.getDomainDnsResolver())) {
LOGGER.debug("New value of domainDnsResolver field for stack {} is {}", stack.getResourceCrn(), actualDnsResolverType);
stack.setDomainDnsResolver(actualDnsResolverType);
stackService.save(stack);
LOGGER.debug("domainDnsResolver field of stack {} has been successfully updated!", stack.getResourceCrn());
} else {
LOGGER.debug("Currently set and actual domainDnsResolverType is the same, not need for update, value {}", actualDnsResolverType);
}
} catch (Exception e) {
LOGGER.debug("We couldn't update domainDnsResolver field of stack, so we move on with current value of the field.", e);
}
return new UpdateDomainDnsResolverResult(event.getResourceId());
}
Aggregations