cfmcgrady commented on code in PR #2082:
URL: 
https://github.com/apache/incubator-celeborn/pull/2082#discussion_r1387414709


##########
common/src/main/scala/org/apache/celeborn/common/util/CelebornHadoopUtils.scala:
##########
@@ -77,21 +77,20 @@ object CelebornHadoopUtils extends Logging {
   }
 
   def initKerberos(conf: CelebornConf, hadoopConf: Configuration): Unit = {
-    // If we are accessing HDFS and it has Kerberos enabled, we have to login
-    // from a keytab file so that we can access HDFS beyond the kerberos 
ticket expiration.
     UserGroupInformation.setConfiguration(hadoopConf)
-    if (conf.hdfsStorageKerberosEnabled) {
-      val principal = conf.hdfsStorageKerberosPrincipal
-        .getOrElse(throw new NoSuchElementException(
-          CelebornConf.HDFS_STORAGE_KERBEROS_PRINCIPAL.key))
-      val keytab = conf.hdfsStorageKerberosKeytab
-        .getOrElse(throw new 
NoSuchElementException(CelebornConf.HDFS_STORAGE_KERBEROS_KEYTAB.key))
-      if (!new File(keytab).exists()) {
-        throw new CelebornException(s"Keytab file: ${keytab} does not exist")
-      } else {
-        logInfo("Attempting to login to Kerberos " +
-          s"using principal: ${principal} and keytab: ${keytab}")
-        UserGroupInformation.loginUserFromKeytab(principal, keytab)
+    if 
("kerberos".equals(hadoopConf.get("hadoop.security.authentication").toLowerCase))
 {
+      (conf.hdfsStorageKerberosPrincipal, conf.hdfsStorageKerberosKeytab) 
match {
+        case (Some(principal), Some(keytab)) =>
+          logInfo("Attempting to login to Kerberos " +
+            s"using principal: ${principal} and keytab: ${keytab}")

Review Comment:
   ```suggestion
             logInfo(
               s"Attempting to login to Kerberos using principal: $principal 
and keytab: $keytab")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to