如何与chef一起安装python模块?

2024-05-14 17:51:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我们使用的是默认安装了Python的EngineYard。但是,当我们启用SSL时,我们从logentries chef recipe接收到以下错误消息。

“警告:“ssl”模块不存在。使用不可靠的解决方法,无法验证主机标识。如果可能,请安装“ssl”模块或更新版本的Python(2.6)

我正在寻找一种方法来安装SSL模块与厨师食谱,但我只是没有足够的经验。有人能告诉我正确的方向吗?

资源: Logentries厨师食谱:https://github.com/logentries/le_chef

日志条目和文档:https://logentries.com/doc/engineyard/

SSL模块:http://pypi.python.org/pypi/ssl/


Tags: 模块方法httpspypicom消息ssl错误
3条回答

现在似乎有了一个更好的社区支持的解决方案(基于它被记录在opscode website上的事实)。

你可以尝试:

include_recipe 'python'
python_pip 'ssl'

如文件所述:herehere

您可以使用PythonBrew:https://github.com/utahta/pythonbrew安装一个新的Python。只需在构建之前安装libssl,否则它仍然无法使用SSL。然而,根据警告,SSL似乎可以工作,但它无法验证主机。当然,这是SSL的一个主要目的,所以这很可能不是一个起点。

高温高压

我刚刚写了一个配方,现在可以在EngineYard上运行最新的Logentries客户端。给你:

file_dir = "/mnt/src/python-ssl"
file_name = "ssl-1.15.tar.gz"
file_path = File.join(file_dir,file_name)
uncompressed_file_dir = File.join(file_dir, file_name.split(".tar.gz").first)

directory file_dir do
  owner "deploy"
  group "deploy"
  mode "0755"
  recursive true
  action :create
end

remote_file file_path do
  source "http://pypi.python.org/packages/source/s/ssl/ssl-1.15.tar.gz"
  mode "0644"
  not_if { File.exists?(file_path) }
end

execute "gunzip ssl" do
  command "gunzip -c #{file_name} | tar xf -"
  cwd file_dir
  not_if { File.exists?(uncompressed_file_dir) }
end

installed_file_path = File.join(uncompressed_file_dir, "installed")

execute "install python ssl module" do
  command "python setup.py install"
  cwd uncompressed_file_dir
  not_if { File.exists?(installed_file_path) }
end

execute "touch #{installed_file_path}" do
  action :run
end

相关问题 更多 >

    热门问题