You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by go...@apache.org on 2016/03/16 21:58:04 UTC

[13/50] incubator-slider git commit: SLIDER-1065 kdiag test failing on host without default realm

SLIDER-1065 kdiag test failing on host without default realm


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/05a1cc4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/05a1cc4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/05a1cc4f

Branch: refs/heads/feature/SLIDER-906_docker_support
Commit: 05a1cc4ff213f48c84147b1ec46207ec9db73939
Parents: 5e430f3
Author: Steve Loughran <st...@apache.org>
Authored: Mon Jan 18 18:05:35 2016 -0800
Committer: Steve Loughran <st...@apache.org>
Committed: Mon Jan 18 18:05:35 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/security/KerberosDiags.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/05a1cc4f/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java b/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
index aa7eec6..d43b966 100644
--- a/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
+++ b/slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
@@ -77,6 +77,7 @@ public class KerberosDiags implements Closeable {
   public static final String HADOOP_AUTHENTICATION_IS_DISABLED
       = "Hadoop authentication is disabled";
   public static final String UNSET = "(unset)";
+  public static final String NO_DEFAULT_REALM = "Cannot locate default realm";
 
   private final Configuration conf;
   private final List<String> services;
@@ -250,12 +251,22 @@ public class KerberosDiags implements Closeable {
       println("Default Realm = %s",
           getDefaultRealm());
     } catch (ClassNotFoundException
-        | InvocationTargetException
         | IllegalAccessException
         | NoSuchMethodException e) {
 
       throw new KerberosDiagsFailure(CAT_JVM, e,
-          "Failed to get default realm");
+          "Failed to invoke krb5.Config.getDefaultRealm: %s", e);
+    } catch (InvocationTargetException e) {
+      if (e.toString().contains(NO_DEFAULT_REALM)) {
+        // exception raised if there is no default realm. This is not
+        // always a problem, so downgrade to a message.
+        println("Host has no default realm");
+        LOG.debug(e.toString(), e);
+      } else {
+        Throwable cause = e.getCause() != null ? e.getCause() : e;
+        throw new KerberosDiagsFailure(CAT_JVM, cause,
+            "Failed get default realm: %s", cause);
+      }
     }
   }