From 86b66cb113709b51aaa26a80ef5af913c353140a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <post@soeren-henning.de>
Date: Sun, 13 Sep 2020 21:06:53 +0200
Subject: [PATCH] Use flag `--if-exists` for Kafka topic deletion

Fix #70
---
 execution/run_uc1.sh | 2 +-
 execution/run_uc2.sh | 2 +-
 execution/run_uc3.sh | 2 +-
 execution/run_uc4.sh | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/execution/run_uc1.sh b/execution/run_uc1.sh
index 04eb86edc..7dc0e4e97 100755
--- a/execution/run_uc1.sh
+++ b/execution/run_uc1.sh
@@ -76,7 +76,7 @@ echo "Finished execution, print topics:"
 #kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(titan-.*|input|output|configuration)( - marked for deletion)?$/p'
 while test $(kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(theodolite-.*|input|output|configuration)( - marked for deletion)?$/p' | wc -l) -gt 0
 do
-    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|output|configuration|theodolite-.*'"
+    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|output|configuration|theodolite-.*' --if-exists"
     echo "Wait for topic deletion"
     sleep 5s
     #echo "Finished waiting, print topics:"
diff --git a/execution/run_uc2.sh b/execution/run_uc2.sh
index a2a43a806..c294e735b 100755
--- a/execution/run_uc2.sh
+++ b/execution/run_uc2.sh
@@ -75,7 +75,7 @@ echo "Finished execution, print topics:"
 #kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(titan-.*|input|output|configuration)( - marked for deletion)?$/p'
 while test $(kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(theodolite-.*|input|aggregation-feedback|output|configuration)( - marked for deletion)?$/p' | wc -l) -gt 0
 do
-    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|aggregation-feedback|output|configuration|theodolite-.*'"
+    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|aggregation-feedback|output|configuration|theodolite-.*' --if-exists"
     echo "Wait for topic deletion"
     sleep 5s
     #echo "Finished waiting, print topics:"
diff --git a/execution/run_uc3.sh b/execution/run_uc3.sh
index f214e20b3..953718228 100755
--- a/execution/run_uc3.sh
+++ b/execution/run_uc3.sh
@@ -77,7 +77,7 @@ echo "Finished execution, print topics:"
 #kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(titan-.*|input|output|configuration)( - marked for deletion)?$/p'
 while test $(kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(theodolite-.*|input|output|configuration)( - marked for deletion)?$/p' | wc -l) -gt 0
 do
-    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|output|configuration|theodolite-.*'"
+    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|output|configuration|theodolite-.*' --if-exists"
     echo "Wait for topic deletion"
     sleep 5s
     #echo "Finished waiting, print topics:"
diff --git a/execution/run_uc4.sh b/execution/run_uc4.sh
index 04fd13069..91366a49d 100755
--- a/execution/run_uc4.sh
+++ b/execution/run_uc4.sh
@@ -76,7 +76,7 @@ echo "Finished execution, print topics:"
 #kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(titan-.*|input|output|configuration)( - marked for deletion)?$/p'
 while test $(kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --list" | sed -n -E '/^(theodolite-.*|input|output|configuration)( - marked for deletion)?$/p' | wc -l) -gt 0
 do
-    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|output|configuration|theodolite-.*'"
+    kubectl exec kafka-client -- bash -c "kafka-topics --zookeeper my-confluent-cp-zookeeper:2181 --delete --topic 'input|output|configuration|theodolite-.*' --if-exists"
     echo "Wait for topic deletion"
     sleep 5s
     #echo "Finished waiting, print topics:"
-- 
GitLab