我开发了几个Fabric在 Jelastic 环境中自动部署我的 Web 应用程序的脚本。这些脚本每次都能完美运行,直到今天。这个问题让我感到困惑,因为自上次成功执行以来,我的脚本和环境都没有改变;唯一值得注意的变化是我的 Jelastic 提供商(ServNet 墨西哥)现在正在运行 Jelastic 平台的 4.9 版。
我的本地环境:
我在另外两台机器上遇到了完全相同的问题,都使用 MacOS Sierra 和等效的 Python 和 Fabric 设置,但是使用旧版本的 Fabric 包(及其依赖项),几天前工作得很好。
在 Fabric 之外,通过 PuTTY(在 Windows 上)和终端(MacOS)的 SSH 访问正常工作。最近发生的一件事是,在远程 session 开始时会显示一个身份验证横幅(它会警告 SSH 访问的危险,如下所示)。我怀疑这与我的问题有关。
推荐by this troubleshooting page on the Fabric documentation ,我为 fab 命令启用了 --show=debug 标志,并为 Paramiko 进行了日志记录。我的命令窗口上的输出如下所示(我省略了一些可能被认为是私有(private)和敏感的行,据我所知,这些行没有提供手头问题的相关信息):
Command line prompt>fab --show=debug my_task
Using fabfile '<path_to_fabric_script>'
Commands to run: my_task
Parallel tasks now using pool size of 0
<sensitive information omitted>
Parallel tasks now using pool size of 10
<sensitive information omitted>
[<jelastic_node>] run: /bin/bash -l -c "cd /var/lib/jelastic/backup && rm -f <file_to_delete>"
DEBUG:paramiko.transport:starting thread (client mode): 0x3cd61d0L
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.1.1
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-JSSHProxy
INFO:paramiko.transport:Connected (version 2.0, client JSSHProxy)
DEBUG:paramiko.transport:kex algos:[u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp521', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-gcm@openssh.com', u'arcfour256', u'arcfour128'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-gcm@openssh.com', u'arcfour256', u'arcfour128'] client mac:[u'hmac-sha1', u'hmac-sha1-96'] server mac:[u'hmac-sha1', u'hmac-sha1-96'] client compress:[u'none'] server compress:[u'none'] client lang:[u''] server lang:[u''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: diffie-hellman-group1-sha1
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha1-96
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexGroup1 specified hash_algo <built-in function openssl_sha1>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-rsa host key for [gate.jl.serv.net.mx]:3022: <key>
DEBUG:paramiko.transport:Trying SSH agent key <key>
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Auth banner:
Welcome to Jelastic shell
This shell will assist you in managing Jelastic applications.
============================== ATTENTION ==============================
Shell access is rather powerful and you can accidentally damage your application.
So please pay special attention to the actions you perform here.
============================== ATTENTION ==============================
INFO:paramiko.transport:Authentication (publickey) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
Fabric 任务就在此时挂起。没有进一步的输出,没有任何类型的成功或失败消息,没有超时,没有任何指示可能发生的事情。而且 Fabric 任务的命令本身也不会运行,因为预期的效果不会在 Fabric 任务所针对的 Jelastic 节点上产生(我拥有的最简单的任务只是应该使用 rm 命令删除一些备份文件;其他任务我开发的更精细,它们也不会运行。)
我倾向于认为这个问题与新的 (4.9) Jelastic 版本或它在我的 Jelastic 提供商基础设施上的特定部署有关。不幸的是,当我就此事向他们寻求帮助时,我的提供者并没有提供帮助。
我很感激任何关于可能发生的事情的线索。
最佳答案
您可以尝试使用选项 --keepalive=5..10 连接
关于ssh - 用于自动化 Web 应用程序部署的 Fabric 脚本不再适用于 Jelastic 4.9 版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41905832/