From 583526939c330b67b0392f99315e765c55a7117d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Vonheiden?= <bjoern.vonheiden@hotmail.de>
Date: Fri, 18 Sep 2020 11:35:21 +0200
Subject: [PATCH] Enhance reset of zookeeper in run uc py

---
 execution/run_uc.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/execution/run_uc.py b/execution/run_uc.py
index f884a8fc6..ca911d817 100644
--- a/execution/run_uc.py
+++ b/execution/run_uc.py
@@ -396,8 +396,8 @@ def reset_zookeeper():
         '--',
         'bash',
         '-c',
-        'zookeeper-shell my-confluent-cp-zookeeper:2181 deleteall'
-        + ' /workload-generation'
+        'zookeeper-shell my-confluent-cp-zookeeper:2181 deleteall '
+        + '/workload-generation'
     ]
 
     check_zoo_data_command = [
@@ -407,8 +407,8 @@ def reset_zookeeper():
         '--',
         'bash',
         '-c',
-        'zookeeper-shell my-confluent-cp-zookeeper:2181 ls /'
-        # "| awk -F[\]\[] '{print $2}'"
+        'zookeeper-shell my-confluent-cp-zookeeper:2181 get '
+        + '/workload-generation'
     ]
 
     # Wait for configuration deletion
@@ -425,12 +425,12 @@ def reset_zookeeper():
                                 text=True)
         logging.debug(output)
 
-        if 'workload-generation' in output.stdout:
-            print('ZooKeeper reset was not successful. Retrying in 5s.')
-            time.sleep(5)
-        else:
+        if output.returncode == 1: # Means data not available anymore
             print('ZooKeeper reset was successful.')
             break
+        else:
+            print('ZooKeeper reset was not successful. Retrying in 5s.')
+            time.sleep(5)
     return
 
 
-- 
GitLab