Skip to content
Snippets Groups Projects
Commit 59a6f4be authored by Benedikt Wetzel's avatar Benedikt Wetzel Committed by Sören Henning
Browse files

Throw DeploymentFailedException if patcher creating fails

parent 5ec2003c
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!146Throw DeploymentFailedException if patcher creating fails,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
This commit is part of merge request !146. Comments created here will be created in the context of that merge request.
package theodolite.patcher package theodolite.patcher
import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.KubernetesResource
import theodolite.util.DeploymentFailedException
import theodolite.util.PatcherDefinition import theodolite.util.PatcherDefinition
/** /**
...@@ -27,7 +28,9 @@ class PatcherFactory { ...@@ -27,7 +28,9 @@ class PatcherFactory {
k8sResources: List<Pair<String, KubernetesResource>> k8sResources: List<Pair<String, KubernetesResource>>
): Patcher { ): Patcher {
val resource = val resource =
k8sResources.filter { it.first == patcherDefinition.resource }.map { resource -> resource.second }[0] k8sResources.filter { it.first == patcherDefinition.resource }.map { resource -> resource.second }.firstOrNull()
?: throw DeploymentFailedException("Could not find resource ${patcherDefinition.resource}")
return when (patcherDefinition.type) { return when (patcherDefinition.type) {
"ReplicaPatcher" -> ReplicaPatcher(resource) "ReplicaPatcher" -> ReplicaPatcher(resource)
"NumNestedGroupsLoadGeneratorReplicaPatcher" -> NumNestedGroupsLoadGeneratorReplicaPatcher(resource) "NumNestedGroupsLoadGeneratorReplicaPatcher" -> NumNestedGroupsLoadGeneratorReplicaPatcher(resource)
......
package theodolite.util
class DeploymentFailedException(message:String): Exception(message) {
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment