This is an automated email from the ASF dual-hosted git repository.

eyang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 205dd2d  HADOOP-16367.  Fixed MiniYarnCluster AuthenticationFilter 
initialization.                Contributed by Prabhu Joseph
205dd2d is described below

commit 205dd2d8e1db46a8d4e1711e7b74e4e5fe162686
Author: Eric Yang <[email protected]>
AuthorDate: Wed Jun 12 18:03:33 2019 -0400

    HADOOP-16367.  Fixed MiniYarnCluster AuthenticationFilter initialization.
                   Contributed by Prabhu Joseph
---
 .../apache/hadoop/yarn/server/MiniYARNCluster.java | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
index fa69f18..19c4eb4 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
@@ -25,9 +25,13 @@ import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
+import java.util.LinkedHashSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+import org.apache.commons.lang3.StringUtils;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
@@ -90,6 +94,7 @@ import 
org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptE
 import 
org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptRegistrationEvent;
 import 
org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptUnregistrationEvent;
 import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
+import 
org.apache.hadoop.yarn.server.security.http.RMAuthenticationFilterInitializer;
 import org.apache.hadoop.yarn.server.timeline.MemoryTimelineStore;
 import org.apache.hadoop.yarn.server.timeline.TimelineStore;
 import 
org.apache.hadoop.yarn.server.timeline.recovery.MemoryTimelineStateStore;
@@ -824,6 +829,26 @@ public class MiniYARNCluster extends CompositeService {
 
     @Override
     protected synchronized void serviceStart() throws Exception {
+
+      // Removing RMAuthenticationFilter as it conflitcs with
+      // TimelineAuthenticationFilter
+      Configuration conf = getConfig();
+      String filterInitializerConfKey = "hadoop.http.filter.initializers";
+      String initializers = conf.get(filterInitializerConfKey, "");
+      String[] parts = initializers.split(",");
+      Set<String> target = new LinkedHashSet<String>();
+      for (String filterInitializer : parts) {
+        filterInitializer = filterInitializer.trim();
+        if (filterInitializer.equals(
+            RMAuthenticationFilterInitializer.class.getName())
+            || filterInitializer.isEmpty()) {
+          continue;
+        }
+        target.add(filterInitializer);
+      }
+      initializers = StringUtils.join(target, ",");
+      conf.set(filterInitializerConfKey, initializers);
+
       appHistoryServer.start();
       if (appHistoryServer.getServiceState() != STATE.STARTED) {
         // AHS could have failed.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to