0
votes

I'm trying to use the windows_http_acl lwrp inside one of my cookbooks.

When I try and use it, I get this error.

================================================================================
  Recipe Compile Error in c:/chef/cache/cookbooks/foo/recipes/bar.rb
  ================================================================================

  NoMethodError
  -------------
  No resource or method named `windows_http_acl' for `Chef::Recipe "bar"'

  Cookbook Trace:
  ---------------
    c:/chef/cache/cookbooks/foo/recipes/bar.rb:26:in `from_file'

  Relevant File Content:
  ----------------------
  c:/chef/cache/cookbooks/foo/recipes/bar.rb:


   26>> windows_http_acl 'http://+:8080/' do
   27:    user "#{node['domain']}\\foobar"
   28:  end
   29:

My module metadata.rb

....

depends          'windows', '~> 1.37.0'
depends          'iis', '~> 4.1.1'
depends          'chef_handler'

Compare to the opscode/windows metadata.rb

My Berksfile

source "https://supermarket.chef.io"

metadata

cookbook 'windows', git: 'https://github.com/opscode-cookbooks/windows.git'    
cookbook 'iis', git: 'https://github.com/opscode-cookbooks/iis.git'

My default recipe

include_recipe 'windows'
include_recipe 'foo::bar'

I have tried running the chef client with debugging, which unfortunately does not reveal any information.

I have even tried to fork the opscode/windows cookbook and add a 'provides windows_http_acl' statement to the metadata.rb file.

version          '1.37.0'
supports         'windows'
source_url       "https://github.com/opscode-cookbooks/windows"
issues_url       "https://github.com/opscode-cookbooks/windows/issues"
depends          'chef_handler'

provides         'windows_http_acl'

What could be causing my cookbook to be unable to find the windows_http_acl resource? I'm pretty new to chef, so maybe there is something simple I"m missing.

Update

I have tried deleting the berksfile.lock to make sure it didn't have an older version

DEPENDENCIES
  foo
    path: .
    metadata: true
  iis
    git: https://github.com/opscode-cookbooks/iis.git
    revision: 58fffd8eb30ac34cc99672995e12289556a4a074
  windows
    git: https://github.com/opscode-cookbooks/windows.git
    revision: b469294f7581863f8d76f8b0c0fbfb5dc2617983

GRAPH
  foo(0.x.x)
    chef_handler (>= 0.0.0)
    iis (~> 4.1.1)
    windows (~> 1.37.0)
  chef_handler (1.1.9)
  iis (4.1.1)
    windows (>= 1.34.6)
  windows (1.37.0)
    chef_handler (>= 0.0.0)
2

2 Answers

2
votes

A more correct version than the other answer would be

berks upload windows --force --no-freeze

This will force the upload even though you likely froze it on a previous upload. This is a general issue with running pre-release version of a cookbook.

0
votes

As pointed out by coderanger on IRC. Running the following command reveled that the resource was absent from my chef server.

knife cookbook show windows 1.37.0 providers

I deleted the cookbook and reuploaded and the http_acl.rb resource is now listed.

knife cookbook delete windows
rm Berksfile.lock && berks install && berks upload