def get_arr_simple(cmd): """send cmd and convert response to dict array, parse single layer """ res = ins.cmd(cmd) arr = _get_arr_simple(res) log.write('get_arr: %s\n %s' % (str(cmd), str(arr))) return arr
def get_arr(cmd): """send cmd and convert response to dict array """ res = ins.cmd(cmd) arr = _get_arr(res) log.write('get_arr: %s\n %s' % (str(cmd), str(arr))) return arr
def get_status_lines_sp(cmd): """return status code and output lines array """ (status, lines) = ins.get_status_lines_sp(cmd) log.write('get_status_lines: %s\n %s - %s' % (cmd, str(status), str(lines))) return (status, lines)
def get_status_arr_simple(cmd): """return status code and dict array, single layer """ (status, lines) = ins.get_status_lines(cmd) if status != 0: log.write('get_status_arr ERROR: %s\n %s - %s' % (cmd, str(status), str(lines))) return (status, lines) else: try: arr = _get_arr_simple(lines) log.write('get_status_arr: %s\n %s - %s' % (cmd, str(status), str(arr))) return (status, arr) except Exception: return (127, ['analyze the cmd output error'])
def get_showarr(cmd): """send cmd and convert response to dict array """ res = get_lines(cmd) log.write('get_showarr: %s\n %s' % (cmd, str(res))) return res
def get_lines(cmd): """get cmd response """ res = ins.cmd(cmd) log.write('get_lines: %s\n %s' % (str(cmd), str(res))) return res
def execute(cmd): """only execute command, just return $? """ res = ins.execute(cmd) log.write('excute: %s\n %s' % (str(cmd), str(res))) return res