Exemple #1
0
def getIterationOutput(host, cmd):
    try:
        checkItem = 'List All'
        stdin, stdout, stderr = execCommand(host, cmd)
        lines = []
        lines = stdout.read().split()
        msg = ">> " + cmd
        for i in lines:
            msg = msg + "\n" + i
        logStatus(checkItem, host[4], msg)
    except Exception as e:
        logStatus(checkItem, host[4], "Error:" + str(e))
        raise ConnectionError('Connection error throw')
Exemple #2
0
def runScriptOutput(host, cmd):
    try:
        stdin, stdout, stderr = execCommand(host, cmd)
        lines = []
        lines = stdout.read().split()
        msg = ""
        skipPwd = 0  #usually index > 4, value @ 5
        for index, value in enumerate(lines):
            msg += value
        print msg
    except Exception as e:
        #print str(e)
        raise ConnectionError('Connection error')
Exemple #3
0
def checkLastFile(host, path):
    try:
        #add your command here
        checkItem = 'get last file'
        cmd = "ls -Art " + path + " | tail -n 1"
        stdin, stdout, stderr = execCommand(host, cmd)
        lines = []
        lines = stdout.read().split()
        filepath = ""
        for index, value in enumerate(lines):
            #  print index
            filepath = value
        return filepath
    except Exception as e:
        logStatus(checkItem, host[4], "Error" + str(e))
        raise ConnectionError('Connection error throw')
Exemple #4
0
def checkProcess(host, cmd):
    try:
        checkItem = 'Process'
        stdin, stdout, stderr = execCommand(host, cmd)
        lines = []
        lines = stdout.read().split()
        msg = ">> " + cmd
        for index, value in enumerate(lines):
            if value.isdigit():  #vlc will add one line in http port 808x
                msg = msg + "\n" + value
            else:
                msg = msg + " " + value
        logStatus(checkItem, host[4], msg)
    except Exception as e:
        logStatus(checkItem, host[4], "Error:" + str(e))
        raise ConnectionError('Connection error throw')
Exemple #5
0
def checkCloudRecordingbyPath(host, folderpath):
    try:
        checkItem = 'Recording Check'
        stdin, stdout, stderr = execCommand(host, folderpath)
        lines = []
        lines = stdout.read().split()
        msg = ">> " + cmd + "\n"
        for index, value in enumerate(lines):
            #print (index, value)
            #2, 11, 20 carriage return
            msg = msg + " " + value
            if ((index - 2) % 9 == 0):  #??
                msg = msg + "\n"
        logStatus(checkItem, host[4], msg)
    except Exception as e:
        logStatus(checkItem, host[4], "Error:" + str(e))
        raise ConnectionError('Connection error throw')
def runScriptOutput(host, cmd):
    try:
        stdin, stdout, stderr = execCommand(host, cmd)
        lines = []
        lines = stdout.read().split()
        msg = ""
        skipPwd = 0  #usually index > 4, value @ 5
        for index, value in enumerate(lines):
            #only check if use execSudoCommand
            #if (host[2]=="root"):
            #    skipPwd = -1
            #elif "password" in value :
            #    skipPwd = index + 2
            #print "%d %s :%d" % (index, value,skipPwd)
            #if (skipPwd!=0) and (index > skipPwd):
            msg = value
        print msg
    except Exception as e:
        #print str(e)
        raise ConnectionError('Connection error')