aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject aurora git commit: Disabling h2 console by default.
Date Tue, 30 Jun 2015 19:32:39 GMT
Repository: aurora
Updated Branches:
  refs/heads/master a1af1f670 -> 616ef10e6


Disabling h2 console by default.

Reviewed at https://reviews.apache.org/r/36060/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/616ef10e
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/616ef10e
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/616ef10e

Branch: refs/heads/master
Commit: 616ef10e67c9fb682525d94b31623f6dc64dc90a
Parents: a1af1f6
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Tue Jun 30 12:32:17 2015 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Tue Jun 30 12:32:17 2015 -0700

----------------------------------------------------------------------
 .../vagrant/upstart/aurora-scheduler-kerberos.conf  |  3 ++-
 .../aurora/scheduler/http/H2ConsoleModule.java      | 16 ++++++++++++++--
 .../aurora/scheduler/http/H2ConsoleModuleIT.java    |  2 +-
 .../scheduler/http/api/security/HttpSecurityIT.java |  2 +-
 4 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/616ef10e/examples/vagrant/upstart/aurora-scheduler-kerberos.conf
----------------------------------------------------------------------
diff --git a/examples/vagrant/upstart/aurora-scheduler-kerberos.conf b/examples/vagrant/upstart/aurora-scheduler-kerberos.conf
index 3c9e13b..85052ac 100644
--- a/examples/vagrant/upstart/aurora-scheduler-kerberos.conf
+++ b/examples/vagrant/upstart/aurora-scheduler-kerberos.conf
@@ -52,4 +52,5 @@ exec bin/aurora-scheduler \
   -shiro_ini_path=/home/vagrant/aurora/src/test/resources/org/apache/aurora/scheduler/http/api/security/shiro-example.ini
\
   -http_authentication_mechanism=NEGOTIATE \
   -kerberos_server_keytab=/home/vagrant/krb5-1.13.1/build/testdir/HTTP-192.168.33.7.keytab
\
-  -kerberos_server_principal=HTTP/192.168.33.7@KRBTEST.COM
+  -kerberos_server_principal=HTTP/192.168.33.7@KRBTEST.COM \
+  -enable_h2_console=true

http://git-wip-us.apache.org/repos/asf/aurora/blob/616ef10e/src/main/java/org/apache/aurora/scheduler/http/H2ConsoleModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/H2ConsoleModule.java b/src/main/java/org/apache/aurora/scheduler/http/H2ConsoleModule.java
index a44ea08..c847e42 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/H2ConsoleModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/H2ConsoleModule.java
@@ -13,6 +13,7 @@
  */
 package org.apache.aurora.scheduler.http;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableMap;
 import com.google.inject.servlet.ServletModule;
 import com.twitter.common.args.Arg;
@@ -30,11 +31,22 @@ public class H2ConsoleModule extends ServletModule {
   public static final String H2_PERM = "h2_management_console";
 
   @CmdLine(name = "enable_h2_console", help = "Enable H2 DB management console.")
-  private static final Arg<Boolean> ENABLE_H2_CONSOLE = Arg.create(true);
+  private static final Arg<Boolean> ENABLE_H2_CONSOLE = Arg.create(false);
+
+  private final boolean enabled;
+
+  public H2ConsoleModule() {
+    this(ENABLE_H2_CONSOLE.get());
+  }
+
+  @VisibleForTesting
+  public H2ConsoleModule(boolean enabled) {
+    this.enabled = enabled;
+  }
 
   @Override
   protected void configureServlets() {
-    if (ENABLE_H2_CONSOLE.get()) {
+    if (enabled) {
       filter(H2_PATH, H2_PATH + "/*").through(LeaderRedirectFilter.class);
       serve(H2_PATH, H2_PATH + "/*").with(new WebServlet(), ImmutableMap.of(
           "webAllowOthers", "true",

http://git-wip-us.apache.org/repos/asf/aurora/blob/616ef10e/src/test/java/org/apache/aurora/scheduler/http/H2ConsoleModuleIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/H2ConsoleModuleIT.java b/src/test/java/org/apache/aurora/scheduler/http/H2ConsoleModuleIT.java
index 9536fe3..6ffb370 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/H2ConsoleModuleIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/H2ConsoleModuleIT.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertEquals;
 public class H2ConsoleModuleIT extends JettyServerModuleTest {
   @Override
   protected Module getChildServletModule() {
-    return new H2ConsoleModule();
+    return new H2ConsoleModule(true);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/aurora/blob/616ef10e/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
index 53ba949..7cc4fa5 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
@@ -146,7 +146,7 @@ public class HttpSecurityIT extends JettyServerModuleTest {
   protected Module getChildServletModule() {
     return Modules.combine(
         new ApiModule(),
-        new H2ConsoleModule(),
+        new H2ConsoleModule(true),
         new HttpSecurityModule(new IniShiroRealmModule(ini)),
         new AbstractModule() {
           @Override


Mime
View raw message