Chef infra 厨师:没有名为“的配方奶粉”;“httpd”;

Chef infra 厨师:没有名为“的配方奶粉”;“httpd”;,chef-infra,chef-recipe,cookbook,Chef Infra,Chef Recipe,Cookbook,我正在学习chef,在尝试安装httpd包时被困在这里。我有一个在Mac OS上安装httpd包的简单方法。我安装了ChefDK webserver.rb package 'httpd' 当我运行chef apply webserver.rb时,它会抛出错误: Mixlib::ShellOut::ShellCommandFailed ------------------------------------ Expected process to exit with [0], but

我正在学习chef,在尝试安装httpd包时被困在这里。我有一个在Mac OS上安装httpd包的简单方法。我安装了ChefDK

webserver.rb

package 'httpd' 
当我运行
chef apply webserver.rb
时,它会抛出错误:

    Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of brew info --json=v1 httpd ----
STDOUT: 
STDERR: Error: No available formula with the name "httpd"
---- End output of brew info --json=v1 httpd ----
Ran brew info --json=v1 httpd returned 1

Resource Declaration:
---------------------
# In webserver.rb

  1: package 'httpd'

Compiled Resource:
------------------
# Declared in webserver.rb:1:in `run_chef_recipe'

homebrew_package("httpd") do
  action [:install]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  package_name "httpd"
  declared_type :package
  cookbook_name "(chef-apply cookbook)"
  recipe_name "(chef-apply recipe)"
end

谁能告诉我我错过了什么。谢谢。

让我们来看看你正在做的每一件事:

chef apply
获取单个厨师配方并在本地运行。这意味着发生的一切都在你的Mac笔记本电脑上

此配方使用
资源安装一个名为
'httpd'
的东西。Chef为
软件包
资源提供了一系列提供者,因此在Ubuntu上它使用APT,在CentOS上它使用YUM,在OS X上它使用自制(即
brew安装

在安装包之前,Chef会检查包是否已经安装,并收集包的其他详细信息。对于自制,它使用
brew info
进行此操作。因此,最后使用命令
brew info httpd
,给出或接受JSON输出格式参数,以便于解析。Homebrew没有名为
'httpd'
的程序包(公式),因此它返回一个错误,然后Chef会向上引发该链


在更深层次上,Homebrew没有打包Apache(我猜您正在尝试安装),因为它在OS X中是默认的。即使它打包了,大多数打包系统都称它为apache2。只有RHEL/CentOS的衍生产品仍然调用该包
httpd

谢谢@coderanger,厨师教程不清楚。我假设这是对所有平台的抽象,抽象的层次只是要使用哪个底层包系统,而不是包的名称/用法。您可以使用
httpd
社区食谱,它为“在我的系统上安装Apache2”提供了更完整的抽象。