【问题标题】:Python 2.7 fabric/paramiko EOF when trying to untar a remote file尝试解压远程文件时的 Python 2.7 fabric/paramiko EOF
【发布时间】:2011-06-22 03:41:28
【问题描述】:

我正在尝试使用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,它们是相等的。当我登录到远程机器时,我能够解压文件而不会出错。

【问题讨论】:

  • 我今天使用fabric.contrib.project.upload_project也遇到了同样的错误,但也许你想使用upload_project,它会为你节省一些复杂性。我改用了 fabric.contrib.project.rsync_project 因为它有效。也许这是一个 bug.fab --version Fabric 1.3.2

标签: python python-2.7 eof fabric


【解决方案1】:

对于您来说,这仍然是新 Fabric 版本中的问题吗?您也可以尝试将详细标志放在 tar 上。可能会淹没 stdout/stdin 管道。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-04
    • 1970-01-01
    • 2020-06-08
    相关资源
    最近更新 更多