hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject hadoop git commit: YARN-8879. Kerberos principal is needed when submitting a submarine job. Contributed by Zac Zhou.
Date Tue, 16 Oct 2018 16:47:59 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 0c2914e58 -> 753f149fd


YARN-8879. Kerberos principal is needed when submitting a submarine job. Contributed by Zac
Zhou.


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

Branch: refs/heads/trunk
Commit: 753f149fd3f5acf9a98cfc780d7899e307c19002
Parents: 0c2914e
Author: Sunil G <sunilg@apache.org>
Authored: Tue Oct 16 22:17:51 2018 +0530
Committer: Sunil G <sunilg@apache.org>
Committed: Tue Oct 16 22:17:51 2018 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java | 5 +----
 .../apache/hadoop/yarn/service/utils/TestServiceApiUtil.java | 8 ++++++++
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/753f149f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
index d201c7d..f055981 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
@@ -245,15 +245,12 @@ public class ServiceApiUtil {
 
   public static void validateKerberosPrincipal(
       KerberosPrincipal kerberosPrincipal) throws IOException {
-    try {
+    if (!StringUtils.isEmpty(kerberosPrincipal.getPrincipalName())) {
       if (!kerberosPrincipal.getPrincipalName().contains("/")) {
         throw new IllegalArgumentException(String.format(
             RestApiErrorMessages.ERROR_KERBEROS_PRINCIPAL_NAME_FORMAT,
             kerberosPrincipal.getPrincipalName()));
       }
-    } catch (NullPointerException e) {
-      throw new IllegalArgumentException(
-          RestApiErrorMessages.ERROR_KERBEROS_PRINCIPAL_MISSING);
     }
     if (!StringUtils.isEmpty(kerberosPrincipal.getKeytab())) {
       try {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/753f149f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/utils/TestServiceApiUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/utils/TestServiceApiUtil.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/utils/TestServiceApiUtil.java
index 1e3c180..4940f8b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/utils/TestServiceApiUtil.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/utils/TestServiceApiUtil.java
@@ -652,6 +652,14 @@ public class TestServiceApiUtil extends ServiceTestUtils {
     } catch (IllegalArgumentException e) {
       Assert.fail(NO_EXCEPTION_PREFIX + e.getMessage());
     }
+
+    kp.setPrincipalName(null);
+    kp.setKeytab(null);
+    try {
+      ServiceApiUtil.validateKerberosPrincipal(app.getKerberosPrincipal());
+    } catch (NullPointerException e) {
+        Assert.fail(NO_EXCEPTION_PREFIX + e.getMessage());
+    }
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message