Fix bug which allowed creation of hosts with superordinate domains in pending delete state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154716883
This commit is contained in:
mountford 2017-05-01 08:08:14 -07:00 committed by Ben McIlwain
parent 386d2bc6be
commit 11e7374c0f
7 changed files with 82 additions and 0 deletions

View file

@ -28,6 +28,7 @@ import com.googlecode.objectify.VoidWork;
import google.registry.config.RegistryConfig.Config;
import google.registry.mapreduce.MapreduceRunner;
import google.registry.model.domain.DomainResource;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
import google.registry.request.Action;
import google.registry.request.Parameter;
@ -107,6 +108,14 @@ public class RdeHostLinkAction implements Runnable {
logger.infofmt("Host %s is out of zone", xjcHost.getName());
return;
}
if (superordinateDomain.get().getStatusValues().contains(StatusValue.PENDING_DELETE)) {
getContext()
.incrementCounter(
"post-import hosts with superordinate domains in pending delete");
logger.infofmt(
"Host %s has a superordinate domain in pending delete", xjcHost.getName());
return;
}
// at this point, the host is definitely in zone and should be linked
getContext().incrementCounter("post-import hosts in zone");
final Key<DomainResource> superordinateDomainKey = Key.create(superordinateDomain.get());