Skip to content
Snippets Groups Projects
Commit 852a54b3 authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

small fixes, cleanup

parent e3f8881f
No related branches found
No related tags found
1 merge request!201Introduce action commands
......@@ -54,7 +54,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) {
.writingOutput(out)
.writingError(error)
.writingErrorChannel(errChannelStream)
.usingListener(MyPodExecListener(execLatch))
.usingListener(ActionCommandListener(execLatch))
.exec(*command)
val latchTerminationStatus = execLatch.await(timeout, TimeUnit.SECONDS);
......@@ -105,7 +105,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) {
}.toInt()
}
fun getPodName(matchLabels: MutableMap<String, String>, tries: Int): String {
private fun getPodName(matchLabels: MutableMap<String, String>, tries: Int): String {
for (i in 1..tries) {
try {
......@@ -136,13 +136,13 @@ class ActionCommand(val client: NamespacedKubernetesClient) {
}
}
private class MyPodExecListener(val execLatch: CountDownLatch) : ExecListener {
private class ActionCommandListener(val execLatch: CountDownLatch) : ExecListener {
override fun onOpen(response: Response) {
}
override fun onFailure(throwable: Throwable, response: Response) {
execLatch.countDown()
throw ActionCommandFailedException("Some error encountered while executing action.", throwable)
throw ActionCommandFailedException("Some error encountered while executing action, caused ${throwable.message})")
}
override fun onClose(code: Int, reason: String) {
......
......@@ -8,7 +8,6 @@ import io.fabric8.kubernetes.client.utils.Utils
import io.quarkus.test.junit.QuarkusTest
import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import theodolite.execution.operator.TheodoliteController
import theodolite.execution.operator.TheodoliteOperator
import theodolite.util.ActionCommandFailedException
......
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