YARN-8879. Kerberos principal is needed when submitting a submarine job. Contributed by Zac Zhou.
This commit is contained in:
parent
0c2914e582
commit
753f149fd3
@ -245,15 +245,12 @@ public static void validateAndResolveService(Service service,
|
||||
|
||||
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 {
|
||||
|
@ -652,6 +652,14 @@ public void testKerberosPrincipalNameFormat() throws IOException {
|
||||
} 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
|
||||
|
Loading…
Reference in New Issue
Block a user