【问题标题】:How would you install a python module with chef?您将如何使用 Chef 安装 python 模块?
【发布时间】:2014-07-19 00:07:22
【问题描述】:

我们使用默认安装 Python 的 EngineYard。但是,当我们启用 SSL 时,我们从 logentries 厨师食谱中收到以下错误消息。

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

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

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

日志 EY 文档:https://logentries.com/doc/engineyard/

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

【问题讨论】:

  • 1.您可以手动安装您的 ssl 模块(不使用厨师)吗? 2. 写下安装步骤,你必须做。 3.将您的步骤转换为厨师资源。 4. 把它们写成一个完整的食谱。这些步骤中的哪一个对您来说有问题?

标签: python chef-infra engineyard


【解决方案1】:

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

你可以试试:

include_recipe 'python'
python_pip 'ssl'

如文档所述:herehere

【讨论】:

  • 此答案中的食谱参考现已弃用。 README 现在转发到github.com/poise/poise-python
  • poise-python 项目现已存档,不建议更换:/
【解决方案2】:

我刚刚为此编写了一个配方,现在可以在 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

【讨论】:

    【解决方案3】:

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

    HTH

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-24
      • 2018-11-17
      • 2014-11-09
      • 2019-07-21
      • 1970-01-01
      • 2015-09-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多