"No resource or method named `windows_package' "when installing simple windows package using chef

StackOverflow https://stackoverflow.com/questions/21781257

  •  11-10-2022
  •  | 
  •  

Question

After experimenting with chef on linux, I'm now trying that in a windows environment. So my first goal is to:

  • Setup a chef-client in my local windows machine
  • Write a simple recipe to install a windows package via chef-solo

I'm stuck on point 2 as I couldn't install any using windows cookbooks. Maybe I dont know how to use this in a windows platform. So i hope anyone here will catch my error out.

What I done was:

  • Downloaded windows cookbooks from opscode-windows-cookbooks.
  • Copied the cookbooks to my cookbooks folder.
  • Edited the default.rb available in windows-master folder by adding code for installing PuTTY
  • Created a testrole.json file with contents:

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

  • Created a solo.rb file with contents:

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

Now when I run the command in cmd window. Following is the result

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:

What was I missing here? Any ideas.

Thanks in advance.

Was it helpful?

Solution

It looks like you are hitting CHEF-5011, which accidentally slipped into the 11.10 release. This bug incorrectly reports the cause of an error. You can read the information on the ticket, but your best bet is to downgrade to Chef 11.8 until the next hotfix is applied to the 11.10 series.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top