mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Filter domains w/disallowed statuses from zone file generation MR
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147839827
This commit is contained in:
parent
a1537a51a9
commit
4a92d97a70
3 changed files with 18 additions and 6 deletions
|
@ -195,7 +195,8 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
|
||||||
// Domains never change their tld, so we can check if it's from the wrong tld right away.
|
// Domains never change their tld, so we can check if it's from the wrong tld right away.
|
||||||
if (tlds.contains(domain.getTld())) {
|
if (tlds.contains(domain.getTld())) {
|
||||||
domain = loadAtPointInTime(domain, exportTime).now();
|
domain = loadAtPointInTime(domain, exportTime).now();
|
||||||
if (domain != null) { // A null means the domain was deleted (or not created) at this time.
|
// A null means the domain was deleted (or not created) at this time.
|
||||||
|
if (domain != null && domain.shouldPublishToDns()) {
|
||||||
String stanza = domainStanza(domain, exportTime);
|
String stanza = domainStanza(domain, exportTime);
|
||||||
if (!stanza.isEmpty()) {
|
if (!stanza.isEmpty()) {
|
||||||
emit(domain.getTld(), stanza);
|
emit(domain.getTld(), stanza);
|
||||||
|
|
|
@ -37,6 +37,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||||
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.host.HostResource;
|
import google.registry.model.host.HostResource;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
import google.registry.testing.mapreduce.MapreduceTestCase;
|
import google.registry.testing.mapreduce.MapreduceTestCase;
|
||||||
|
@ -77,12 +78,24 @@ public class GenerateZoneFilesActionTest extends MapreduceTestCase<GenerateZoneF
|
||||||
persistResource(newDomainResource("ns-only.tld").asBuilder()
|
persistResource(newDomainResource("ns-only.tld").asBuilder()
|
||||||
.addNameservers(nameservers)
|
.addNameservers(nameservers)
|
||||||
.build());
|
.build());
|
||||||
|
persistResource(newDomainResource("ns-only-client-hold.tld").asBuilder()
|
||||||
|
.addNameservers(nameservers)
|
||||||
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD))
|
||||||
|
.build());
|
||||||
|
persistResource(newDomainResource("ns-only-pending-delete.tld").asBuilder()
|
||||||
|
.addNameservers(nameservers)
|
||||||
|
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||||
|
.build());
|
||||||
|
persistResource(newDomainResource("ns-only-server-hold.tld").asBuilder()
|
||||||
|
.addNameservers(nameservers)
|
||||||
|
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_HOLD))
|
||||||
|
.build());
|
||||||
|
// These should be ignored; contact and applications aren't in DNS, hosts need to be from the
|
||||||
|
// same tld and have ip addresses, and domains need to be from the same tld and have hosts (even
|
||||||
|
// in the case where domains contain DS data).
|
||||||
persistResource(newDomainResource("ds-only.tld").asBuilder()
|
persistResource(newDomainResource("ds-only.tld").asBuilder()
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
// These should be ignored; contact and applications aren't in DNS, hosts need to be from the
|
|
||||||
// same tld and have ip addresses, and domains need to be from the same tld and have hosts.
|
|
||||||
persistActiveContact("ignored_contact");
|
persistActiveContact("ignored_contact");
|
||||||
persistActiveDomainApplication("ignored_application.tld");
|
persistActiveDomainApplication("ignored_application.tld");
|
||||||
persistActiveHost("ignored.host.tld"); // No ips.
|
persistActiveHost("ignored.host.tld"); // No ips.
|
||||||
|
|
|
@ -6,8 +6,6 @@ ns.bar.tld 3600 IN AAAA 0:0:0:0:0:0:0:1
|
||||||
ns-only.tld 180 IN NS ns.foo.tld.
|
ns-only.tld 180 IN NS ns.foo.tld.
|
||||||
ns-only.tld 180 IN NS ns.bar.tld.
|
ns-only.tld 180 IN NS ns.bar.tld.
|
||||||
|
|
||||||
ds-only.tld 86400 IN DS 1 2 3 000102
|
|
||||||
|
|
||||||
ns-and-ds.tld 180 IN NS ns.foo.tld.
|
ns-and-ds.tld 180 IN NS ns.foo.tld.
|
||||||
ns-and-ds.tld 180 IN NS ns.bar.tld.
|
ns-and-ds.tld 180 IN NS ns.bar.tld.
|
||||||
ns-and-ds.tld 86400 IN DS 1 2 3 000102
|
ns-and-ds.tld 86400 IN DS 1 2 3 000102
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue