source/Tools Integration/CE-Integration/CE-automation-scripts/0-Prerequisites-checks.py [155:258]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    else:
        message = "Incorrect port! "

    if stderr:
        for err in stderr.readlines():
            ssh_err = ssh_err + err
    if "refused" in ssh_err:
        s_result[check] = "Pass"
    if check in s_result:
        print(message + s_result[check])
        if s_result[check] == "Fail":
            if "final_result" in s_result:
                s_result["final_result"] = s_result["final_result"] + check + ","
            else:
                s_result["final_result"] = check + ","
    else:
        if len(ssh_err) > 0:
            s_result["error"] = ssh_err
        s_result[check] = "Fail"
        if "final_result" in s_result:
            s_result["final_result"] = s_result["final_result"] + check + ","
        else:
            s_result["final_result"] = check + ","
        print(message + "Fail")

def check_freespace(ssh, dir, min,  s_result):
    stderr = None
    stdout = None
    ssh_err = ''
    if ssh is not None:
        cmd = "df -h " + dir + " | tail -1 | tr -s ' ' | cut -d' ' -f4"
        try:
            stdin, stdout, stderr = ssh.exec_command(cmd)
            str_output = ''
            for output in stdout.readlines():
                str_output = str_output + output
            value = 0
            if len(str_output) > 0:
                str_output = str_output.strip()
                try:
                    if str_output[-1].lower() == 'g':
                        value = float(str_output[:-1])
                    else:
                        value = float(str_output)
                except ValueError as ve:
                    ssh_err = "Got exception! for the command " + cmd + \
                              ". The output is " + str(ve)
            if value <= min:
                ssh_err = dir + " directory should have a minimum of " + str(
                    min) + " GB free space, but got " + str(value)
        except paramiko.SSHException as e:
            ssh_err = "Got exception! while executing the command " + cmd + \
                      " due to " + str(e)
    else:
        ssh_err = 'Unable to connect! SSH is null'

    if stderr:
        for err in stderr.readlines():
            ssh_err = ssh_err + err
    if len(ssh_err) > 0 :
            s_result["error"] = ssh_err
            s_result["FreeSpace"] = "Fail"
            if "final_result" in s_result:
                s_result["final_result"] = s_result["final_result"] + "FreeSpace" + str(min) + ","
            else:
                s_result["final_result"] = "FreeSpace" + str(min) + ","
            if min == 2.0:
                print(" " + str(min) + " GB " + dir + " FreeSpace      : Fail")
            else:
                print(" " + str(min) + " GB " + dir + " FreeSpace   : Fail")
    else:
        s_result["FreeSpace"] = "Pass"
        if min == 2.0:
            print(" " + str(min) + " GB " + dir + " FreeSpace      : Pass")
        else:
            print(" " + str(min) + " GB " + dir + " FreeSpace   : Pass")


def check_dhclient(ssh, s_result):
    stderr = None
    stdout = None
    ssh_err = ''
    if ssh is not None:
        try:
            stdin, stdout, stderr = ssh.exec_command("sudo dhclient -v")
        except paramiko.SSHException as e:
            ssh_err = "Got exception! " + str(e)
    else:
        ssh_err = 'Unable to connect! SSH is null'

    if stderr:
        for err in stderr.readlines():
            ssh_err = ssh_err + err
    if len(ssh_err) > 0 and 'not found' in ssh_err:
            s_result["error"] = ssh_err
            s_result["DHCLIENT"] = "Fail"
            if "final_result" in s_result:
                s_result["final_result"] = s_result["final_result"] + "DHCLIENT,"
            else:
                s_result["final_result"] = "DHCLIENT,"
            print(" DHCLIENT Package        : Fail")
    else:
        s_result["DHCLIENT"] = "Pass"
        print(" DHCLIENT Package        : Pass")
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



source/Tools Integration/MGN-Integration/MGN-automation-scripts/0-Prerequisites-checks.py [247:350]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    else:
        message = "Incorrect port! "

    if stderr:
        for err in stderr.readlines():
            ssh_err = ssh_err + err
    if "refused" in ssh_err:
        s_result[check] = "Pass"
    if check in s_result:
        print(message + s_result[check])
        if s_result[check] == "Fail":
            if "final_result" in s_result:
                s_result["final_result"] = s_result["final_result"] + check + ","
            else:
                s_result["final_result"] = check + ","
    else:
        if len(ssh_err) > 0:
            s_result["error"] = ssh_err
        s_result[check] = "Fail"
        if "final_result" in s_result:
            s_result["final_result"] = s_result["final_result"] + check + ","
        else:
            s_result["final_result"] = check + ","
        print(message + "Fail")

def check_freespace(ssh, dir, min,  s_result):
    stderr = None
    stdout = None
    ssh_err = ''
    if ssh is not None:
        cmd = "df -h " + dir + " | tail -1 | tr -s ' ' | cut -d' ' -f4"
        try:
            stdin, stdout, stderr = ssh.exec_command(cmd)
            str_output = ''
            for output in stdout.readlines():
                str_output = str_output + output
            value = 0
            if len(str_output) > 0:
                str_output = str_output.strip()
                try:
                    if str_output[-1].lower() == 'g':
                        value = float(str_output[:-1])
                    else:
                        value = float(str_output)
                except ValueError as ve:
                    ssh_err = "Got exception! for the command " + cmd + \
                              ". The output is " + str(ve)
            if value <= min:
                ssh_err = dir + " directory should have a minimum of " + str(
                    min) + " GB free space, but got " + str(value)
        except paramiko.SSHException as e:
            ssh_err = "Got exception! while executing the command " + cmd + \
                      " due to " + str(e)
    else:
        ssh_err = 'Unable to connect! SSH is null'

    if stderr:
        for err in stderr.readlines():
            ssh_err = ssh_err + err
    if len(ssh_err) > 0 :
            s_result["error"] = ssh_err
            s_result["FreeSpace"] = "Fail"
            if "final_result" in s_result:
                s_result["final_result"] = s_result["final_result"] + "FreeSpace" + str(min) + ","
            else:
                s_result["final_result"] = "FreeSpace" + str(min) + ","
            if min == 2.0:
                print(" " + str(min) + " GB " + dir + " FreeSpace      : Fail")
            else:
                print(" " + str(min) + " GB " + dir + " FreeSpace   : Fail")
    else:
        s_result["FreeSpace"] = "Pass"
        if min == 2.0:
            print(" " + str(min) + " GB " + dir + " FreeSpace      : Pass")
        else:
            print(" " + str(min) + " GB " + dir + " FreeSpace   : Pass")


def check_dhclient(ssh, s_result):
    stderr = None
    stdout = None
    ssh_err = ''
    if ssh is not None:
        try:
            stdin, stdout, stderr = ssh.exec_command("sudo dhclient -v")
        except paramiko.SSHException as e:
            ssh_err = "Got exception! " + str(e)
    else:
        ssh_err = 'Unable to connect! SSH is null'

    if stderr:
        for err in stderr.readlines():
            ssh_err = ssh_err + err
    if len(ssh_err) > 0 and 'not found' in ssh_err:
            s_result["error"] = ssh_err
            s_result["DHCLIENT"] = "Fail"
            if "final_result" in s_result:
                s_result["final_result"] = s_result["final_result"] + "DHCLIENT,"
            else:
                s_result["final_result"] = "DHCLIENT,"
            print(" DHCLIENT Package        : Fail")
    else:
        s_result["DHCLIENT"] = "Pass"
        print(" DHCLIENT Package        : Pass")
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



