7 This tool rejoins any isolated controllers to the cluster.
9 A file named 'cluster.json' containing a list of the IP addresses and
10 credentials of the controllers is required. It resides in the same
11 directory as monitor.py.
13 The file should look like this:
18 {"ip": "172.17.10.93", "port": "8181"},
19 {"ip": "172.17.10.93", "port": "8181"},
20 {"ip": "172.17.10.93", "port": "8181"}
27 Usage:python rejoin.py
33 def import_utility_modules():
34 global UtilLibrary, json
36 sys.path.append('../../../csit/libraries')
41 import_utility_modules()
44 with open('cluster.json') as cluster_file:
45 data = json.load(cluster_file)
47 print str(sys.exc_info())
48 print "unable to open the file cluster.json"
51 cluster_list = data["cluster"]["controllers"]
53 for controller in cluster_list:
54 cluster_ips.append(controller["ip"])
55 user_name = data["cluster"]["user"]
56 user_pass = data["cluster"]["pass"]
58 print str(sys.exc_info())
59 print 'Error reading the file cluster.json'
62 print UtilLibrary.flush_iptables(cluster_ips, user_name, user_pass)