Allow deploying RC distributions
[integration/test.git] / tools / clustering / cluster-monitor / rejoin.py
index 92507a0ffd28bc627cceba4b127153a8631c459c..c9735db4f2eb942aa3f5ad7c6753386f96b2e31e 100644 (file)
@@ -15,12 +15,12 @@ The file should look like this:
     {
         "cluster": {
             "controllers": [
-                "172.17.10.93",
-                "172.17.10.94",
-                "172.17.10.95"
+                {"ip": "172.17.10.93", "port": "8181"},
+                {"ip": "172.17.10.93", "port": "8181"},
+                {"ip": "172.17.10.93", "port": "8181"}
             ],
             "user": "username",
-            "pass": "password"
+            "pass": "password",
         }
     }
 
@@ -28,9 +28,17 @@ Usage:python rejoin.py
  """
 
 import sys
-sys.path.append('../../../csit/libraries')
-import UtilLibrary
-import json
+
+
+def import_utility_modules():
+    global UtilLibrary, json
+    import sys
+    sys.path.append('../../../csit/libraries')
+    import UtilLibrary
+    import json
+
+
+import_utility_modules()
 
 try:
     with open('cluster.json') as cluster_file:
@@ -41,6 +49,9 @@ except:
     exit(1)
 try:
     cluster_list = data["cluster"]["controllers"]
+    cluster_ips = []
+    for controller in cluster_list:
+        cluster_ips.append(controller["ip"])
     user_name = data["cluster"]["user"]
     user_pass = data["cluster"]["pass"]
 except:
@@ -48,4 +59,4 @@ except:
     print 'Error reading the file cluster.json'
     exit(1)
 
-print UtilLibrary.flush_iptables(cluster_list, user_name, user_pass)
+print UtilLibrary.flush_iptables(cluster_ips, user_name, user_pass)