utils.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def ssh_exec(ssh, cmd, timeout=None, check_retcode=True, get_pty=False):
    LOG.debug(u"{}Calling SSH: '{}'{}".format(Style.DIM, cmd, Style.RESET_ALL))
    try:
        _, out, err = ssh.exec_command(cmd, timeout=timeout, get_pty=get_pty)
        ret_code = out.channel.recv_exit_status()
        out, err = out.read().strip(), err.read().strip()
    except Exception:
        LOG.debug("Something went wrong in 'ssh_exec':\n{}".format(
            format_exception(sys.exc_info())
        ))
        raise

    _proceed_exec_result(out, err, ret_code, check_retcode)
    return ret_code, out, err
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号