hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject git commit: YARN-2449. Fixed the bug that TimelineAuthenticationFilterInitializer is not automatically added when hadoop.http.filter.initializers is not configured. Contributed by Varun Vasudev.
Date Fri, 29 Aug 2014 16:46:49 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 f237dee15 -> 77a4b014e


YARN-2449. Fixed the bug that TimelineAuthenticationFilterInitializer is not automatically
added when hadoop.http.filter.initializers is not configured. Contributed by Varun Vasudev.

(cherry picked from commit 4bd0194e6be68421eb1dc87f9f031626112e4c50)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/77a4b014
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/77a4b014
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/77a4b014

Branch: refs/heads/branch-2
Commit: 77a4b014e6407ad7d0f6110a6ac96e9d31b1a4e8
Parents: f237dee
Author: Zhijie Shen <zjshen@apache.org>
Authored: Fri Aug 29 09:40:39 2014 -0700
Committer: Zhijie Shen <zjshen@apache.org>
Committed: Fri Aug 29 09:46:04 2014 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  4 +++
 .../ApplicationHistoryServer.java               |  5 ++-
 .../TestApplicationHistoryServer.java           | 35 ++++++++++++++------
 3 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/77a4b014/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index ba70867..5fba3bc 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -231,6 +231,10 @@ Release 2.6.0 - UNRELEASED
 
     YARN-2405. NPE in FairSchedulerAppsBlock. (Tsuyoshi Ozawa via kasha)
 
+    YARN-2449. Fixed the bug that TimelineAuthenticationFilterInitializer
+    is not automatically added when hadoop.http.filter.initializers is not
+    configured. (Varun Vasudev via zjshen)
+
 Release 2.5.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/77a4b014/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
index c61b80e..6ec0d42 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java
@@ -197,6 +197,7 @@ public class ApplicationHistoryServer extends CompositeService {
     // the customized filter will be loaded by the timeline server to do Kerberos
     // + DT authentication.
     String initializers = conf.get("hadoop.http.filter.initializers");
+    boolean modifiedInitialiers = false;
 
     initializers =
         initializers == null || initializers.length() == 0 ? "" : initializers;
@@ -206,6 +207,7 @@ public class ApplicationHistoryServer extends CompositeService {
       initializers =
           TimelineAuthenticationFilterInitializer.class.getName() + ","
               + initializers;
+      modifiedInitialiers = true;
     }
 
     String[] parts = initializers.split(",");
@@ -214,13 +216,14 @@ public class ApplicationHistoryServer extends CompositeService {
       filterInitializer = filterInitializer.trim();
       if (filterInitializer.equals(AuthenticationFilterInitializer.class
         .getName())) {
+        modifiedInitialiers = true;
         continue;
       }
       target.add(filterInitializer);
     }
     String actualInitializers =
         org.apache.commons.lang.StringUtils.join(target, ",");
-    if (!actualInitializers.equals(initializers)) {
+    if (modifiedInitialiers) {
       conf.set("hadoop.http.filter.initializers", actualInitializers);
     }
     String bindAddress = WebAppUtils.getWebAppBindURL(conf,

http://git-wip-us.apache.org/repos/asf/hadoop/blob/77a4b014/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
index bcd8e45..807d2df 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.http.lib.StaticUserWebFilter;
 import org.apache.hadoop.security.AuthenticationFilterInitializer;
 import org.apache.hadoop.service.Service.STATE;
 import org.apache.hadoop.util.ExitUtil;
@@ -33,6 +34,9 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.HashMap;
+import java.util.Map;
+
 public class TestApplicationHistoryServer {
 
   ApplicationHistoryServer historyServer = null;
@@ -75,23 +79,32 @@ public class TestApplicationHistoryServer {
   @Test(timeout = 50000)
   public void testFilteOverrides() throws Exception {
 
-    String[] filterInitializers =
-        {
-            AuthenticationFilterInitializer.class.getName(),
-            TimelineAuthenticationFilterInitializer.class.getName(),
-            AuthenticationFilterInitializer.class.getName() + ","
-                + TimelineAuthenticationFilterInitializer.class.getName(),
-            AuthenticationFilterInitializer.class.getName() + ", "
-                + TimelineAuthenticationFilterInitializer.class.getName() };
-    for (String filterInitializer : filterInitializers) {
+    HashMap<String, String> driver = new HashMap<String, String>();
+    driver.put("", TimelineAuthenticationFilterInitializer.class.getName());
+    driver.put(StaticUserWebFilter.class.getName(),
+      TimelineAuthenticationFilterInitializer.class.getName() + ","
+          + StaticUserWebFilter.class.getName());
+    driver.put(AuthenticationFilterInitializer.class.getName(),
+      TimelineAuthenticationFilterInitializer.class.getName());
+    driver.put(TimelineAuthenticationFilterInitializer.class.getName(),
+      TimelineAuthenticationFilterInitializer.class.getName());
+    driver.put(AuthenticationFilterInitializer.class.getName() + ","
+        + TimelineAuthenticationFilterInitializer.class.getName(),
+      TimelineAuthenticationFilterInitializer.class.getName());
+    driver.put(AuthenticationFilterInitializer.class.getName() + ", "
+        + TimelineAuthenticationFilterInitializer.class.getName(),
+      TimelineAuthenticationFilterInitializer.class.getName());
+
+    for (Map.Entry<String, String> entry : driver.entrySet()) {
+      String filterInitializer = entry.getKey();
+      String expectedValue = entry.getValue();
       historyServer = new ApplicationHistoryServer();
       Configuration config = new YarnConfiguration();
       config.set("hadoop.http.filter.initializers", filterInitializer);
       historyServer.init(config);
       historyServer.start();
       Configuration tmp = historyServer.getConfig();
-      assertEquals(TimelineAuthenticationFilterInitializer.class.getName(),
-        tmp.get("hadoop.http.filter.initializers"));
+      assertEquals(expectedValue, tmp.get("hadoop.http.filter.initializers"));
       historyServer.stop();
       AHSWebApp.resetInstance();
     }


Mime
View raw message