mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 09:57:17 +02:00
Enable Cloud SQL for nomulus command implementing CommandWithRemoteApi (#460)
This commit is contained in:
parent
85d0c426ae
commit
38fab7a63b
6 changed files with 7 additions and 31 deletions
|
@ -156,7 +156,7 @@ public class ClaimsListShard extends ImmutableObject {
|
||||||
try {
|
try {
|
||||||
loadAndCompareCloudSqlList(datastoreList);
|
loadAndCompareCloudSqlList(datastoreList);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.atSevere().withCause(t).log("Error comparing reserved lists.");
|
logger.atSevere().withCause(t).log("Error comparing claims lists.");
|
||||||
}
|
}
|
||||||
return datastoreList;
|
return datastoreList;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Copyright 2019 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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marker interface for commands that use Cloud Sql.
|
|
||||||
*
|
|
||||||
* <p>Just implementing this is sufficient to use Cloud Sql; {@link RegistryTool} will install it as
|
|
||||||
* needed.
|
|
||||||
*/
|
|
||||||
interface CommandWithCloudSql extends CommandWithRemoteApi {}
|
|
|
@ -34,7 +34,7 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
/** Shared base class for commands to registry lock or unlock a domain via EPP. */
|
/** Shared base class for commands to registry lock or unlock a domain via EPP. */
|
||||||
public abstract class LockOrUnlockDomainCommand extends ConfirmingCommand
|
public abstract class LockOrUnlockDomainCommand extends ConfirmingCommand
|
||||||
implements CommandWithCloudSql {
|
implements CommandWithRemoteApi {
|
||||||
|
|
||||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||||
|
|
||||||
|
|
|
@ -212,8 +212,6 @@ final class RegistryCli implements AutoCloseable, CommandRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommandWithRemoteApis need to have the remote api installed to work.
|
// CommandWithRemoteApis need to have the remote api installed to work.
|
||||||
// CommandWithCloudSql extends CommandWithRemoteApi so the command will also get the remote
|
|
||||||
// api installed. This is because the DB password is stored in Datastore.
|
|
||||||
if (command instanceof CommandWithRemoteApi) {
|
if (command instanceof CommandWithRemoteApi) {
|
||||||
if (installer == null) {
|
if (installer == null) {
|
||||||
installer = new RemoteApiInstaller();
|
installer = new RemoteApiInstaller();
|
||||||
|
@ -235,9 +233,10 @@ final class RegistryCli implements AutoCloseable, CommandRunner {
|
||||||
// Make sure we start the command with a clean cache, so that any previous command won't
|
// Make sure we start the command with a clean cache, so that any previous command won't
|
||||||
// interfere with this one.
|
// interfere with this one.
|
||||||
ofy().clearSessionCache();
|
ofy().clearSessionCache();
|
||||||
}
|
|
||||||
|
|
||||||
if (command instanceof CommandWithCloudSql) {
|
// Enable Cloud SQL for command that needs remote API as they will very likely use
|
||||||
|
// Cloud SQL after the database migration. Note that the DB password is stored in Datastore
|
||||||
|
// and it is already initialized above.
|
||||||
RegistryToolEnvironment.get().enableJpaTm();
|
RegistryToolEnvironment.get().enableJpaTm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.joda.time.DateTime;
|
||||||
|
|
||||||
/** Modifies {@link Cursor} timestamps used by locking rolling cursor tasks, like in RDE. */
|
/** Modifies {@link Cursor} timestamps used by locking rolling cursor tasks, like in RDE. */
|
||||||
@Parameters(separators = " =", commandDescription = "Modifies cursor timestamps used by LRC tasks")
|
@Parameters(separators = " =", commandDescription = "Modifies cursor timestamps used by LRC tasks")
|
||||||
final class UpdateCursorsCommand extends ConfirmingCommand implements CommandWithCloudSql {
|
final class UpdateCursorsCommand extends ConfirmingCommand implements CommandWithRemoteApi {
|
||||||
|
|
||||||
@Parameter(description = "TLDs on which to operate. Omit for global cursors.")
|
@Parameter(description = "TLDs on which to operate. Omit for global cursors.")
|
||||||
private List<String> tlds;
|
private List<String> tlds;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
||||||
|
|
||||||
/** A command to upload a {@link ClaimsListShard}. */
|
/** A command to upload a {@link ClaimsListShard}. */
|
||||||
@Parameters(separators = " =", commandDescription = "Manually upload a new claims list file")
|
@Parameters(separators = " =", commandDescription = "Manually upload a new claims list file")
|
||||||
final class UploadClaimsListCommand extends ConfirmingCommand implements CommandWithCloudSql {
|
final class UploadClaimsListCommand extends ConfirmingCommand implements CommandWithRemoteApi {
|
||||||
|
|
||||||
@Parameter(description = "Claims list filename")
|
@Parameter(description = "Claims list filename")
|
||||||
private List<String> mainParameters = new ArrayList<>();
|
private List<String> mainParameters = new ArrayList<>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue