【发布时间】:2015-01-27 18:03:42
【问题描述】:
我正在测试一个 corosync 集群。我正在尝试使具有浮动 IP 的接口失败,以确保资源使用 python 迁移到另一个节点。
现在的困境是我的命令确实在远程机器上执行,但我的测试代码永远挂起,等待它永远不会得到的回复——由于注入失败,节点将重新启动。
ssh = SSHClient(self.get_ms_ip(ms),
self.get_ms_user(ms),
self.get_ms_password(ms))
ssh.connect()
self.logger.info("Failing FIP eth now on %s" % ms)
ssh.exec_command(cmd, timeout=1)
#Code never reached this comment.
在python中,我怎样才能发送命令并继续而不等待任何返回?我已经尝试按照这里的建议Run Process and Don't Wait 用 subprocess.Popen 包装我的 ssh.exec_command,但这并没有产生任何不同。
【问题讨论】:
-
措辞相似的问题——尽管关于不同的问题——不等待长/无限的命令——我相信大多数来到这里的用户实际上会寻找:Do not wait for commands to finish when executing them with Python Paramiko。
标签: python paramiko remotecommand