尝试解压远程文件时出现 Python 2.7 Fabric/paramiko EOF

发布于 2024-10-15 20:13:29 字数 1357 浏览 3 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城缀染半城烟沙 2024-10-22 20:13:29

对于您来说,这在新的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文