Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rtitle committed Nov 9, 2017
1 parent 62f7acd commit bfc4549
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ case class InstanceName(string: String) extends AnyVal with StringValueClass {
}

case class ClusterResource(string: String) extends AnyVal with StringValueClass
case class TemplatedClusterResource(string: String) extends AnyVal with StringValueClass
case class GoogleClientId(string: String) extends AnyVal with StringValueClass

object StringValueClass {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ class LeonardoService(protected val dataprocConfig: DataprocConfig,
clusterFilesConfig, clusterResourcesConfig, proxyConfig, swaggerConfig, serviceAccountKey
).toJson.asJsObject.fields

// Raw files to upload to the bucket, with no additional processing
// Raw files to upload to the bucket, no additional processing needed.
val filesToUpload = List(
clusterFilesConfig.jupyterServerCrt,
clusterFilesConfig.jupyterServerKey,
clusterFilesConfig.jupyterRootCaPem)

// Raw resourcs to upload to the bucket, with no additional processing.
// Raw resources to upload to the bucket, no additional processing needed.
// Note: initActionsScript and jupyterGoogleSignInJs are not included
// because they are post-processed by templating logic.
val resourcesToUpload = List(
Expand Down Expand Up @@ -262,12 +262,12 @@ class LeonardoService(protected val dataprocConfig: DataprocConfig,
}

private[service] def templateFile(file: File, replacementMap: Map[String, JsValue]): String = {
val raw = scala.io.Source.fromFile(file).mkString
val raw = Source.fromFile(file).mkString
template(raw, replacementMap)
}

private[service] def templateResource(resource: ClusterResource, replacementMap: Map[String, JsValue]): String = {
val raw = scala.io.Source.fromResource(s"${ClusterResourcesConfig.basePath}/${resource.string}").mkString
val raw = Source.fromResource(s"${ClusterResourcesConfig.basePath}/${resource.string}").mkString
template(raw, replacementMap)
}

Expand Down

0 comments on commit bfc4549

Please sign in to comment.