Remove deprecated singular DNS writer field and update tooling

Note that even though the nomulus command line tool now supports multiple
DNS writers for all subcommands, this still won't work quite yet because
the DNS task queue format migration from [] is still in progress.
After next week's push that migration will be complete and we can remove
the final restriction against only having one DNS writer per TLD.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162490399
This commit is contained in:
mcilwain 2017-07-19 08:47:48 -07:00 committed by Ben McIlwain
parent 8ff1102223
commit d3e9ebad16
8 changed files with 101 additions and 123 deletions

View file

@ -25,6 +25,8 @@ import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Sets;
import google.registry.model.pricing.StaticPremiumListPricingEngine;
import google.registry.model.registry.Registries;
import google.registry.model.registry.Registry;
@ -51,7 +53,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
@Inject
@Named("dnsWriterNames")
Set<String> dnsWriterNames;
Set<String> validDnsWriterNames;
@Parameter(description = "Names of the TLDs", required = true)
List<String> mainParameters;
@ -220,11 +222,9 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
@Nullable
@Parameter(
names = "--dns_writer",
description = "The name of the DnsWriter implementation to use",
converter = OptionalStringParameter.class,
validateWith = OptionalStringParameter.class)
Optional<String> dnsWriter;
names = "--dns_writers",
description = "A comma-separated list of DnsWriter implementations to use")
List<String> dnsWriters;
@Nullable
@Parameter(
@ -388,12 +388,15 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
}
}
if (dnsWriter != null && dnsWriter.isPresent()) {
checkArgument(
dnsWriterNames.contains(dnsWriter.get()),
"The DNS writer '%s' doesn't exist",
dnsWriter.get());
builder.setDnsWriters(ImmutableSet.of(dnsWriter.get()));
if (dnsWriters != null) {
ImmutableSet<String> dnsWritersSet = ImmutableSet.copyOf(dnsWriters);
ImmutableSortedSet<String> invalidDnsWriters =
ImmutableSortedSet.copyOf(Sets.difference(dnsWritersSet, validDnsWriterNames));
checkArgument(
invalidDnsWriters.isEmpty(),
"Invalid DNS writer name(s) specified: %s",
invalidDnsWriters);
builder.setDnsWriters(dnsWritersSet);
}
if (lrpPeriod != null) {