Friday, June 14, 2013

Chef: Cannot find a resource for powershell on windows version 6.1.7600 (solved)

While working on some deployment stuff I ran into this error:

Cannot find a resource for powershell on windows version 6.1.7600

The solution turned out to be pretty obvious, and easy: include the powershell cookbook. For some reason I assumed it came in as part of the windows cookbook, but no. So just include it in your metadata.rb file like so:

name             '...'
maintainer       '...'
maintainer_email '...'
description      '...'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '0.1.0'
depends          'windows'
depends          'powershell'

Of course, if you’re using Chef Solo, you’ll want to download your dependent cookbooks, too.

2 comments:

seema said...

Hi,
I have facing the error
"cannot find a resource for windows_package on windows version 6.1.7601"
during executing cookbook.
Please give me the solution.

Harsha Biyani said...

You have to add dependency in metadata.rb .
Add following lines at the end of file metadata.rb

1.%w{ windows }.each do |dep|
2. depends dep
3.end