我正在尝试使用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
我可以使用结构执行其他 sudo 命令,但解压缩文件似乎中断了。我比较了本地文件和远程文件的md5sum,它们是相等的。当我登录到远程机器时,我能够解压文件而不会出错。