コード例 #1
0
ファイル: isolate.py プロジェクト: amir876/integration-test
import_utility_modules()

try:
    with open('cluster.json') as cluster_file:
        data = json.load(cluster_file)
except:
    print str(sys.exc_info())
    print "unable to open the file cluster.json"
    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:
    print str(sys.exc_info())
    print 'Error reading the file cluster.json'
    exit(1)
try:
    isolate = int(sys.argv[1])
except:
    print 'You must specify the number (e.g. 1, 2, 3) of the controller to isolate.'
    exit(1)

print "isolating controller " + str(isolate)

print UtilLibrary.isolate_controller(cluster_ips, user_name, user_pass, isolate)
コード例 #2
0
import_utility_modules()

try:
    with open('cluster.json') as cluster_file:
        data = json.load(cluster_file)
except:
    print str(sys.exc_info())
    print "unable to open the file cluster.json"
    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:
    print str(sys.exc_info())
    print 'Error reading the file cluster.json'
    exit(1)
try:
    isolate = int(sys.argv[1])
except:
    print 'You must specify the number (e.g. 1, 2, 3) of the controller to isolate.'
    exit(1)

print "isolating controller " + str(isolate)

print UtilLibrary.isolate_controller(cluster_ips, user_name, user_pass,
                                     isolate)