我正在使用Opscode的应用程序_python食谱,并试图部署Django应用程序。我需要在这个项目中使用Python2.7,但是虚拟环境的创建在默认情况下是用python2.6完成的,我不打算在系统上安装它。因此,在运行chef-client时会出现以下错误:
[Fri, 08 Jun 2012 16:55:35 +0000] FATAL: Mixlib::ShellOut::ShellCommandFailed: execute[virtualenv --python=python2.6 /opt/apps/trippingbear/shared/env] (/var/chef/cache/cookbooks/python/providers/virtualenv.rb line 28) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '3'
---- Begin output of virtualenv --python=python2.6 /opt/apps/trippingbear/shared/env ----
STDOUT: The executable python2.6 (from --python=python2.6) does not exist
STDERR:
---- End output of virtualenv --python=python2.6 /opt/apps/trippingbear/shared/env ----
Ran virtualenv --python=python2.6 /opt/apps/trippingbear/shared/env returned 3我对厨师长非常(非常)陌生,而且对如何改变它还没有什么想法。默认设置似乎是用attribute :interpreter, :default => 'python2.6'在cookbooks/python/resources/virtualenv.rb中设置的。我尝试将我的节点和环境中的默认值设置为以下内容,但没有成功:
default_attributes(
"python" => {
"virtualenv" => {
"interpreter" => "python2.7"
}
}
)我肯定这是可配置的,但我不知道怎么做。我是怎么不对的?
发布于 2012-06-27 15:33:38
我总是在我的部署菜谱中显式地创建我的virtualenv,然后根据需要引用该virtualenv。例如:
venv_dir = node['some_identifier']['virtualenv_dir']
python_virtualenv venv_dir do
interpreter "python" # use system default python, not 2.6
action :create
end
python_pip "django" do
version "1.4"
action :install
virtualenv venv_dir
end显然,这是从python中使用python_virtualenv资源,因此需要将python作为一个依赖项列出在您的食谱中。
https://serverfault.com/questions/396990
复制相似问题