ruby-on-rails - "No resource or method named ` windows_package ' "使用 chef 安装简单的 windows 包时

标签 ruby-on-rails chef-infra knife

在 linux 上试用 chef 之后,我现在正在 windows 环境中尝试。所以我的第一个目标是:

  • 在我的本地 Windows 机器上设置一个 chef-client
  • 写一个简单的 Recipe 通过 chef-solo 安装 windows 包

我卡在了第 2 点,因为我无法安装任何使用 Windows 的说明书。也许我不知道如何在 Windows 平台上使用它。所以我希望这里的任何人都能发现我的错误。

我所做的是:

  • opscode-windows-cookbooks .
  • 将 Recipe 复制到我的 Recipe 文件夹中。
  • 通过添加编辑了 windows-master 文件夹中可用的 default.rb PuTTY安装代码
  • 创建了一个包含以下内容的 testrole.json 文件:

{ "run_list": [ "recipe[windows-master]" ] }

  • 创建了一个包含以下内容的 solo.rb 文件:

    cookbook_path "C:/chef/chef-repo/cookbooks"

现在,当我在 cmd 窗口中运行命令时。结果如下

C:\chef\chef-repo>chef-solo -c solo.rb -j testrole.json
Starting Chef Client, version 11.10.0
Compiling Cookbooks...
Recipe: windows-master::default
  * chef_gem[win32-api] action install (up to date)
  * chef_gem[win32-service] action install (up to date)
  * chef_gem[windows-api] action install (up to date)
  * chef_gem[windows-pr] action install (up to date)
  * chef_gem[win32-dir] action install (up to date)
  * chef_gem[win32-event] action install (up to date)
  * chef_gem[win32-mutex] action install (up to date)

================================================================================

Recipe Compile Error in C:/chef/chef-repo/cookbooks/windows-master/recipes/defau
lt.rb
================================================================================


NoMethodError
-------------
No resource or method named `windows_package' for `Chef::Recipe "default"'

Cookbook Trace:
---------------
  C:/chef/chef-repo/cookbooks/windows-master/recipes/default.rb:35:in `from_file
'

Relevant File Content:
----------------------
C:/chef/chef-repo/cookbooks/windows-master/recipes/default.rb:

 28:
 29:  # the rest
 30:  %w{ windows-api windows-pr win32-dir win32-event win32-mutex }.each do |wi
n_gem|
 31:    chef_gem win_gem do
 32:      action :install
 33:    end
 34:  end
 35>> windows_package 'PuTTY version 0.60' do
 36:    source 'http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-instal
ler.exe'
 37:    installer_type :inno
 38:    action :install
 39:  end
 40:
 41:

我在这里错过了什么?任何想法。

提前致谢。

最佳答案

看起来您正在点击 CHEF-5011 ,它不小心滑入了 11.10 版本。此错误错误地报告了错误的原因。您可以阅读票证上的信息,但最好的办法是降级到 Chef 11.8,直到下一个修补程序应用到 11.10 系列。

关于ruby-on-rails - "No resource or method named ` windows_package ' "使用 chef 安装简单的 windows 包时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21781257/

相关文章:

javascript - 在 Ajax 中从另一个页面选择数据

ruby - Chef12 到 Chef13 升级中的路径问题

ruby - 应该在系统范围内还是在用户级别安装 rbenv?

ruby - 删除没有私钥的 Knife 客户端?

amazon-ec2 - 无法使用 FQDN 为 Chef 客户端配置创建节点

ruby-on-rails - 在 Ruby/Rails 中隔离数据访问层的最佳实践

ruby-on-rails - 你建议我使用什么 gem 来实现一个简单的 "Contact us"表单?

ruby-on-rails - 如何最好地使用 Rails 清理丰富的 html?

ruby - 在 Chef 执行期间在 native 扩展包之后安装 gem

chef-infra - Chef PEM 文件无效或命名错误?