3 Controller Isolation Tool
7 This tool isolates an indicated controller from the cluster. The tool takes
8 a single integer argument corresponding to the number of a controller
9 in a json file's ordered list of controllers. This is the controller to
12 A file named 'cluster.json' containing a list of the IP addresses and
13 credentials of the controllers is required. It resides in the same
14 directory as monitor.py.
16 The file should look like this:
30 Usage:python isolate.py [controller to be isolated]
34 sys.path.append('../../../csit/libraries')
39 with open('cluster.json') as cluster_file:
40 data = json.load(cluster_file)
42 print str(sys.exc_info())
43 print "unable to open the file cluster.json"
46 cluster_list = data["cluster"]["controllers"]
47 user_name = data["cluster"]["user"]
48 user_pass = data["cluster"]["pass"]
50 print str(sys.exc_info())
51 print 'Error reading the file cluster.json'
54 isolate = int(sys.argv[1])
56 print 'You must specify the number (e.g. 1, 2, 3) of the controller to isolate.'
59 print "isolating controller " + str(isolate)
61 print UtilLibrary.isolate_controller(cluster_list, user_name, user_pass, isolate)