尝试解压远程文件时出现 Python 2.7 Fabric/paramiko EOF
我正在尝试使用 Fabric 0.92 远程解压文件,但收到来自 paramiko 的 EOF。
def deployFile(self, localdir, remoteroot, filename):
log.info('Deploying file {0} to host {1}...'.format(filename, self.host))
env.password = self.password
env.disable_known_hosts = True
localFile=localdir+"/"+filename
remoteFile='/tmp/{0}'.format(filename)
with settings(host_string = self.connectstring):
log.info('...putting {0}'.format(filename))
put(localFile, "/tmp/", mode=0755)
with cd(remoteroot):
untar='tar zxvf {0}'.format(remoteFile)
log.info('...untarring {0}'.format(filename))
#paramiko.util.log_to_file('paramiko.out')
sudo(untar, pty=True)
我的 paramiko.out 输出:
DEB [20110205-20:49:36.782] thr=1 paramiko.transport: [chan 8] Max packet in: 34816 bytes
DEB [20110205-20:49:36.784] thr=2 paramiko.transport: [chan 7] EOF received (7)
DEB [20110205-20:49:36.785] thr=2 paramiko.transport: [chan 8] Max packet out: 32768 bytes
INF [20110205-20:49:36.785] thr=2 paramiko.transport: Secsh channel 8 opened.
DEB [20110205-20:49:36.788] thr=2 paramiko.transport: EOF in transport thread
我能够使用 Fabric 执行其他 sudo 命令,但解压文件似乎会损坏。我比较了本地文件和远程文件的md5sum,它们是相等的。当我登录到远程计算机时,我能够解压该文件而不会出现错误。
I am trying to remotely untar a file using fabric 0.92, but am receiving an EOF from paramiko.
def deployFile(self, localdir, remoteroot, filename):
log.info('Deploying file {0} to host {1}...'.format(filename, self.host))
env.password = self.password
env.disable_known_hosts = True
localFile=localdir+"/"+filename
remoteFile='/tmp/{0}'.format(filename)
with settings(host_string = self.connectstring):
log.info('...putting {0}'.format(filename))
put(localFile, "/tmp/", mode=0755)
with cd(remoteroot):
untar='tar zxvf {0}'.format(remoteFile)
log.info('...untarring {0}'.format(filename))
#paramiko.util.log_to_file('paramiko.out')
sudo(untar, pty=True)
My output from paramiko.out:
DEB [20110205-20:49:36.782] thr=1 paramiko.transport: [chan 8] Max packet in: 34816 bytes
DEB [20110205-20:49:36.784] thr=2 paramiko.transport: [chan 7] EOF received (7)
DEB [20110205-20:49:36.785] thr=2 paramiko.transport: [chan 8] Max packet out: 32768 bytes
INF [20110205-20:49:36.785] thr=2 paramiko.transport: Secsh channel 8 opened.
DEB [20110205-20:49:36.788] thr=2 paramiko.transport: EOF in transport thread
I am able to perform other sudo commands using fabric, but untarring a file seems to break. I have compared the md5sum of the local file and of the remote file, and they are equal. I am able to untar the file without errors when I log into the remote machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于您来说,这在新的 Fabric 版本中仍然是一个问题吗?您也可以尝试在 tar 上删除详细标志。可能会淹没标准输出/标准输入管道。
Is this still an issue in the new Fabric release for you? Also you might try dropping the verbose flag on the tar. Could perhaps be flooding the stdout/stdin pipes.