Esempio n. 1
0
def clusterdeleteUI():
    really = str(
        input(
            "This will remove your whole Cluster configuration. Are you sure you will delete it? [y/n] > "
        ))
    if (really == "y"):
        FileOperations.clearFile("clusterIndex.cli")
        print("Configuration removed")
    else:
        print("Aborted")
Esempio n. 2
0
def clusterinitUI():
    
    ClusterCount = int(input("Please enter the amount of cluster servers in your network > "))

    counter = 1

    while counter <= ClusterCount:
        ip = input("Please enter the IP of server #" + str(counter) + " > ")
        ip = ip + " "
        cluster = FileOperations.readFile("clusterIndex.cli")
        FileOperations.writeFile("clusterIndex.cli", (cluster + ip))
        counter += 1

    print("Done!")
Esempio n. 3
0
def clusterinitUI():

    ClusterCount = int(
        input("Please enter the amount of cluster servers in your network > "))

    counter = 1

    while counter <= ClusterCount:
        ip = input("Please enter the IP of server #" + str(counter) + " > ")
        ip = ip + " "
        cluster = FileOperations.readFile("clusterIndex.cli")
        FileOperations.writeFile("clusterIndex.cli", (cluster + ip))
        counter += 1

    print("Done!")
Esempio n. 4
0
def clustercheck():

    success = True

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")
    clusterIndex = clusterIndexRaw.split()
    ClusterCount = len(clusterIndex)

    counter = 0

    while counter < ClusterCount:

        try:
            get = client.connect(clusterIndex[counter], 10008, "1+1")

            if(int(get) == 2):
                counter += 1
            else:
                counter += 1
                success = False

        except Exception:
            counter += 1
            success = False
    return success
Esempio n. 5
0
def clustercheck():

    success = True

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")
    clusterIndex = clusterIndexRaw.split()
    ClusterCount = len(clusterIndex)

    counter = 0

    while counter < ClusterCount:

        try:
            get = client.connect(clusterIndex[counter], 10008, "1+1")

            if (int(get) == 2):
                counter += 1
            else:
                counter += 1
                success = False

        except Exception:
            counter += 1
            success = False
    return success
Esempio n. 6
0
def clustercheckUI():

    success = True

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    ClusterCount = len(clusterIndex)

    counter = 0

    while counter < ClusterCount:

        try:

            get = client.connect(clusterIndex[counter], 10008, "1+1")

            if(int(float(get)) == 2):
                print("Server " + clusterIndex[counter] + " OK")
                counter += 1

            else:
                print("Server " + clusterIndex[counter] + " FAIL")
                counter += 1
                success = False

        except Exception:

                print("Server " + clusterIndex[counter] + " FAIL (EXCEPTION IN CODE)")
                counter += 1
                success = False

    print("Done!")
    return success
Esempio n. 7
0
def getClusterLenght():

    get = ""

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    clusterLenght = len(clusterIndex)

    return clusterLenght
Esempio n. 8
0
def getClusterLenght():

    get = ""

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    clusterLenght = len(clusterIndex)

    return clusterLenght
Esempio n. 9
0
def execute(clusterComputer, command, highValue):

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    clusterLenght = len(clusterIndex)

    get = ""

    if(clusterComputer > clusterLenght):
        get = "ERROR!"

    elif highValue == 1:
        get = highValueClient.connect(clusterIndex[(clusterComputer - 1)], 10008, command)
    else:
        get = client.connect(clusterIndex[(clusterComputer - 1)], 10008, command)
    return get
Esempio n. 10
0
def execute(clusterComputer, command, highValue):

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    clusterLenght = len(clusterIndex)

    get = ""

    if (clusterComputer > clusterLenght):
        get = "ERROR!"

    elif highValue == 1:
        get = highValueClient.connect(clusterIndex[(clusterComputer - 1)],
                                      10008, command)
    else:
        get = client.connect(clusterIndex[(clusterComputer - 1)], 10008,
                             command)
    return get
Esempio n. 11
0
def clustercheckUI():

    success = True

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    ClusterCount = len(clusterIndex)

    counter = 0

    while counter < ClusterCount:

        try:

            get = client.connect(clusterIndex[counter], 10008, "1+1")

            if (int(float(get)) == 2):
                print("Server " + clusterIndex[counter] + " OK")
                counter += 1

            else:
                print("Server " + clusterIndex[counter] + " FAIL")
                counter += 1
                success = False

        except Exception:

            print("Server " + clusterIndex[counter] +
                  " FAIL (EXCEPTION IN CODE)")
            counter += 1
            success = False

    print("Done!")
    return success
Esempio n. 12
0
def clusterdeleteUI():
    really = str(input("This will remove your whole Cluster configuration. Are you sure you will delete it? [y/n] > "))
    if(really == "y"):
        FileOperations.clearFile("clusterIndex.cli")
        print("Configuration removed")
    else: print("Aborted")