mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Update transfer data fixing command to fix one more domain
I happened to notice that one domain affected by b/33289763 had existing transfer data, so in that case the data got overwritten to look like a server cancellation (a year after the transfer request, so obviously wrong) rather than creating invalid transfer data, and hence wasn't picked up in the previous fixes. See b/33289763#comment32 for more details. This CL renames the RemoveDomainTransferDataCommand used to fix the errors to FixDomainTransferDataCommand and changes its behavior to instead reset the TransferData to a server-approval result. It also changes it to load domains by ROID because loadByForeignKey() fails for deleted domains. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=159273225
This commit is contained in:
parent
d1ef4b9c37
commit
fc78fd7d4a
3 changed files with 59 additions and 53 deletions
|
@ -15,8 +15,8 @@
|
||||||
package google.registry.tools;
|
package google.registry.tools;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import google.registry.tools.javascrap.FixDomainTransferDataCommand;
|
||||||
import google.registry.tools.javascrap.PopulateNullRegistrarFieldsCommand;
|
import google.registry.tools.javascrap.PopulateNullRegistrarFieldsCommand;
|
||||||
import google.registry.tools.javascrap.RemoveDomainTransferDataCommand;
|
|
||||||
import google.registry.tools.javascrap.RemoveIpAddressCommand;
|
import google.registry.tools.javascrap.RemoveIpAddressCommand;
|
||||||
|
|
||||||
/** Container class to create and run remote commands against a Datastore instance. */
|
/** Container class to create and run remote commands against a Datastore instance. */
|
||||||
|
@ -61,6 +61,7 @@ public final class RegistryTool {
|
||||||
.put("domain_check_fee", DomainCheckFeeCommand.class)
|
.put("domain_check_fee", DomainCheckFeeCommand.class)
|
||||||
.put("encrypt_escrow_deposit", EncryptEscrowDepositCommand.class)
|
.put("encrypt_escrow_deposit", EncryptEscrowDepositCommand.class)
|
||||||
.put("execute_epp", ExecuteEppCommand.class)
|
.put("execute_epp", ExecuteEppCommand.class)
|
||||||
|
.put("fix_domain_transfer_data", FixDomainTransferDataCommand.class)
|
||||||
.put("generate_applications_report", GenerateApplicationsReportCommand.class)
|
.put("generate_applications_report", GenerateApplicationsReportCommand.class)
|
||||||
.put("generate_auction_data", GenerateAuctionDataCommand.class)
|
.put("generate_auction_data", GenerateAuctionDataCommand.class)
|
||||||
.put("generate_dns_report", GenerateDnsReportCommand.class)
|
.put("generate_dns_report", GenerateDnsReportCommand.class)
|
||||||
|
@ -103,7 +104,6 @@ public final class RegistryTool {
|
||||||
.put("publish_detail_report", PublishDetailReportCommand.class)
|
.put("publish_detail_report", PublishDetailReportCommand.class)
|
||||||
.put("registrar_activity_report", RegistrarActivityReportCommand.class)
|
.put("registrar_activity_report", RegistrarActivityReportCommand.class)
|
||||||
.put("registrar_contact", RegistrarContactCommand.class)
|
.put("registrar_contact", RegistrarContactCommand.class)
|
||||||
.put("remove_domain_transfer_data", RemoveDomainTransferDataCommand.class)
|
|
||||||
.put("remove_ip_address", RemoveIpAddressCommand.class)
|
.put("remove_ip_address", RemoveIpAddressCommand.class)
|
||||||
.put("resave_entities", ResaveEntitiesCommand.class)
|
.put("resave_entities", ResaveEntitiesCommand.class)
|
||||||
.put("resave_environment_entities", ResaveEnvironmentEntitiesCommand.class)
|
.put("resave_environment_entities", ResaveEnvironmentEntitiesCommand.class)
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package google.registry.tools.javascrap;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
|
||||||
|
import com.beust.jcommander.Parameter;
|
||||||
|
import com.beust.jcommander.Parameters;
|
||||||
|
import google.registry.model.domain.DomainResource;
|
||||||
|
import google.registry.model.transfer.TransferData;
|
||||||
|
import google.registry.model.transfer.TransferStatus;
|
||||||
|
import google.registry.tools.MutatingCommand;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scrap tool to fix domain transfer data corrupted in b/33289763.
|
||||||
|
*
|
||||||
|
* <p>A bug caused some domains to have their transfer data overwritten with SERVER_CANCELLED
|
||||||
|
* resolved transfer data upon their deletion, regardless of the original transfer data. The
|
||||||
|
* previous version of this tool fixed domains where their original transfer data was empty by just
|
||||||
|
* removing the corrupted transfer data. However, one other domain was affected that did have
|
||||||
|
* pre-existing transfer data; this domain was not fixed earlier, so this new version of the scrap
|
||||||
|
* tool fixes it by restoring what the original server-approved transfer data.
|
||||||
|
*/
|
||||||
|
@Parameters(separators = " =", commandDescription = "Fix transfer data for b/33289763.")
|
||||||
|
public class FixDomainTransferDataCommand extends MutatingCommand {
|
||||||
|
|
||||||
|
@Parameter(description = "Domain roids", required = true)
|
||||||
|
private List<String> mainParameters;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() throws Exception {
|
||||||
|
for (String domainRoid : mainParameters) {
|
||||||
|
DomainResource domain = ofy().load().type(DomainResource.class).id(domainRoid).now();
|
||||||
|
checkNotNull(domain);
|
||||||
|
TransferData fixedTransferData =
|
||||||
|
domain.getTransferData().asBuilder()
|
||||||
|
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||||
|
.setPendingTransferExpirationTime(domain.getLastTransferTime())
|
||||||
|
.build();
|
||||||
|
stageEntityChange(domain, domain.asBuilder().setTransferData(fixedTransferData).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,51 +0,0 @@
|
||||||
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package google.registry.tools.javascrap;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
|
||||||
import static org.joda.time.DateTimeZone.UTC;
|
|
||||||
|
|
||||||
import com.beust.jcommander.Parameter;
|
|
||||||
import com.beust.jcommander.Parameters;
|
|
||||||
import google.registry.model.domain.DomainResource;
|
|
||||||
import google.registry.model.transfer.TransferData;
|
|
||||||
import google.registry.tools.MutatingCommand;
|
|
||||||
import java.util.List;
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scrap tool to remove domain transfer data.
|
|
||||||
*
|
|
||||||
* <p>A bug has caused some domains to have invalid transfer data; the status is SERVER_CANCELLED,
|
|
||||||
* but other fields such as the gaining and losing registrar are blank. Since there was never an
|
|
||||||
* actual transfer, the proper course of action is to remove the invalid data. See b/33289763.
|
|
||||||
*/
|
|
||||||
@Parameters(separators = " =", commandDescription = "Remove transfer data.")
|
|
||||||
public class RemoveDomainTransferDataCommand extends MutatingCommand {
|
|
||||||
|
|
||||||
@Parameter(description = "Fully-qualified domain names", required = true)
|
|
||||||
private List<String> mainParameters;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() throws Exception {
|
|
||||||
DateTime now = DateTime.now(UTC);
|
|
||||||
for (String domainName : mainParameters) {
|
|
||||||
DomainResource domain = loadByForeignKey(DomainResource.class, domainName, now);
|
|
||||||
checkNotNull(domain);
|
|
||||||
stageEntityChange(domain, domain.asBuilder().setTransferData(TransferData.EMPTY).build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue