以下结构脚本是我需要使用的开源脚本,不幸的是我不熟悉这些东西。结构文件以以下内容开头:
from fabric.api import *
import time
env.user = 'aegir'
env.shell = '/bin/bash -c'
# Download and import a platform using Drush Make
def build_platform(site, profile, webserver, dbserver, makefile, build):
print "===> Building the platform..."
run("drush make %s /var/aegir/platforms/%s" % (makefile, build))
当 Git 推送触发新构建时,结构文件由 Jenkins 服务器运行。执行此文件时,第一个远程操作(最后一行)会导致以下错误。
/usr/lib/python2.6/getpass.py:83: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Password for [email protected]: ===> Building the platform...
[o1.sub.aegir.local] run: drush make https://raw.github.com/mig5/builds/master/mig5_platform.build /var/aegir/platforms/20121011010955
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/fabric/main.py", line 435, in main
commands[name](*args, **kwargs)
File "/usr/local/bin/fabfile.py", line 11, in build_platform
run("drush make %s /var/aegir/platforms/%s" % (makefile, build))
File "/usr/lib/pymodules/python2.6/fabric/network.py", line 390, in host_prompting_wrapper
return func(*args, **kwargs)
File "/usr/lib/pymodules/python2.6/fabric/operations.py", line 414, in run
channel = connections[env.host_string]._transport.open_session()
File "/usr/lib/pymodules/python2.6/fabric/network.py", line 65, in __getitem__
self[real_key] = connect(user, host, port)
File "/usr/lib/pymodules/python2.6/fabric/network.py", line 219, in connect
password = prompt_for_password(password, text)
File "/usr/lib/pymodules/python2.6/fabric/network.py", line 279, in prompt_for_password
new_password = getpass.getpass(password_prompt)
File "/usr/lib/python2.6/getpass.py", line 83, in unix_getpass
passwd = fallback_getpass(prompt, stream)
File "/usr/lib/python2.6/getpass.py", line 118, in fallback_getpass
return _raw_input(prompt, stream)
File "/usr/lib/python2.6/getpass.py", line 135, in _raw_input
raise EOFError
EOFError
Build step 'Execute shell' marked build as failure
Finished: FAILURE
我是否必须为 aegir 用户指定密码?我试图在
env.password = ''
下包含 passwd --delete aegir
(我在远程机器上用 env.user = 'aegir'
删除了 Aegir 的用户密码),但这并没有解决任何问题。 最佳答案
ssh 服务禁止没有密码的用户进行远程访问。您可以在机器上和 fabfile 中为 aegir
用户设置密码。
关于python - Getpass 错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12872495/