ssh.py 文件源码

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

项目:ceph-lcm 作者: Mirantis 项目源码 文件源码
def connect(srv_model, ctx):
    ssh_command = shutil.which("ssh")
    if not ssh_command:
        raise ValueError("Cannot find ssh command")

    ssh_command = [ssh_command]
    ssh_command.append("-4")
    ssh_command.append("-tt")
    ssh_command.append("-x")
    ssh_command.extend(("-o", "UserKnownHostsFile=/dev/null"))
    ssh_command.extend(("-o", "StrictHostKeyChecking=no"))
    ssh_command.extend(("-l", srv_model.username))
    ssh_command.extend(("-i", ctx.obj["identity_file"]))
    ssh_command.extend(ctx.obj["ssh_args"])
    ssh_command.append(srv_model.ip)

    LOG.debug("Execute %s", ssh_command)

    pty.spawn(ssh_command)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号