spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vanzin <...@git.apache.org>
Subject [GitHub] spark pull request #20167: Allow providing Mesos principal & secret via file...
Date Thu, 11 Jan 2018 21:09:14 GMT
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20167#discussion_r161075477
  
    --- Diff: resource-managers/mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerUtils.scala
---
    @@ -80,10 +80,27 @@ trait MesosSchedulerUtils extends Logging {
         }
         fwInfoBuilder.setHostname(Option(conf.getenv("SPARK_PUBLIC_DNS")).getOrElse(
           conf.get(DRIVER_HOST_ADDRESS)))
    +    conf.getOption("spark.mesos.principal.file")
    +      .orElse(Option(conf.getenv("SPARK_MESOS_PRINCIPAL_FILE"))
    +      .foreach { principalFile =>
    +        val file = io.Source.fromFile(principalFile)
    +        val principal = file.getLines.next()
    +        file.close
    +        fwInfoBuilder.setPrincipal(principal)
    +        credBuilder.setPrincipal(principal)
    +      }
         conf.getOption("spark.mesos.principal").foreach { principal =>
           fwInfoBuilder.setPrincipal(principal)
           credBuilder.setPrincipal(principal)
         }
    +    conf.getOption("spark.mesos.secret.file")
    +      .orElse(Option(conf.getenv("SPARK_MESOS_SECRET_FILE"))
    +      .foreach { secretFile =>
    +       val file = io.Source.fromFile(secretFile)
    --- End diff --
    
    You should use `Files.toString()` (from Guava) here (simpler and also handles errors properly).
    
    The whole block is also indented incorrectly.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message