在 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"
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/