Skip to content
Snippets Groups Projects
Commit d1e83654 authored by Sören Henning's avatar Sören Henning
Browse files

Minor code quality fixes

parent c4283e7b
No related branches found
No related tags found
No related merge requests found
Pipeline #6138 failed
This commit is part of merge request !230. Comments created here will be created in the context of that merge request.
...@@ -41,15 +41,20 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource { ...@@ -41,15 +41,20 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource {
return try { return try {
resources resources
.map { Pair( .map {
Pair(
getKind(resource = it.value), getKind(resource = it.value),
it) } it
)
}
.map { .map {
Pair( Pair(
it.second.key, it.second.key,
loader.loadK8sResource(it.first, it.second.value)) } loader.loadK8sResource(it.first, it.second.value)
)
}
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
throw DeploymentFailedException("Can not create resource set from specified configmap", e) throw DeploymentFailedException("Cannot create resource set from specified ConfigMap", e)
} }
} }
...@@ -58,10 +63,7 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource { ...@@ -58,10 +63,7 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource {
val parser = YamlParserFromString() val parser = YamlParserFromString()
val resourceAsMap = parser.parse(resource, HashMap<String, String>()::class.java) val resourceAsMap = parser.parse(resource, HashMap<String, String>()::class.java)
return try { return resourceAsMap?.get("kind")
resourceAsMap?.get("kind") !! ?: throw DeploymentFailedException("Could not find field kind of Kubernetes resource: ${resourceAsMap?.get("name")}")
} catch (e: NullPointerException) {
throw DeploymentFailedException( "Could not find field kind of Kubernetes resource: ${resourceAsMap?.get("name")}", e)
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment