Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error loading Opscode::IIS::Helper::Windows #149

Closed
agperson opened this issue Mar 10, 2015 · 7 comments
Closed

Compile error loading Opscode::IIS::Helper::Windows #149

agperson opened this issue Mar 10, 2015 · 7 comments

Comments

@agperson
Copy link

There is an error with this cookbook on Linux (tested on Amazon Linux 2014.9 and CentOS 7.0) when running under Chef client 12.1+. Attempting to converge with a run list of "recipe[chef-client]" (which transitively depends on "iis") fails with the following error. This error does not occur when using the latest Chef 11 client to converge. Hiding the include Windows::Helper statement under an if RUBY_PLATFORM resolves the error. I wonder if there is some new behavior in Chef 12 that prevents a Windows library from loading on Linux?

================================================================================
Recipe Compile Error in /root/.chef/local-mode-cache/cache/cookbooks/iis/libraries/helper.rb
================================================================================

NameError
---------
uninitialized constant Opscode::IIS::Helper::Windows

Cookbook Trace:
---------------
  /root/.chef/local-mode-cache/cache/cookbooks/iis/libraries/helper.rb:31:in `<module:Helper>'
  /root/.chef/local-mode-cache/cache/cookbooks/iis/libraries/helper.rb:24:in `<module:IIS>'
  /root/.chef/local-mode-cache/cache/cookbooks/iis/libraries/helper.rb:23:in `<module:Opscode>'
  /root/.chef/local-mode-cache/cache/cookbooks/iis/libraries/helper.rb:22:in `<top (required)>'

Relevant File Content:
----------------------
/root/.chef/local-mode-cache/cache/cookbooks/iis/libraries/helper.rb:

 29:        require 'rexml/document'
 30:        include REXML
 31>>       include Windows::Helper
 32:
 33:        def self.older_than_windows2008r2?
@EasyAsABC123
Copy link
Contributor

This is a question above my pay grade, i'll apply the patch that resolved the issue immediately and then we will need to deep dive.

@btm
Copy link
Contributor

btm commented Mar 10, 2015

Because the iis cookbook depends on the windows cookbook, the windows/libraries/windows_helper.rb should be loaded first. I'll look to see if something changed between 12.0.3 and 12.1.0 that could affect load order.

@agperson
Copy link
Author

I did not see it being loaded first when I ran in debug mode.

@agperson
Copy link
Author

In the normal course of events the chef-client cookbook does not depend on IIS (which...makes sense), I was only picking it up due to an unrelated error.

I don't know if there are other cases where a multi-platform cookbook might depend on this cookbook and a Linux user could run into this error. I suspect it is possible, but since my example was flawed I don't know the likelihood. Close or fix as you see fit. :)

@btm
Copy link
Contributor

btm commented Mar 10, 2015

@agperson glad we resolved chef-boneyard/chef-client#285. In this situation though, I'm not sure why we aren't seeing the windows cookbook being loaded first, which should be where that module comes from.

Can you confirm that the copy of the iis cookbook that you're running has a dependency on the windows cookbook in it's metadata, and what the version of the windows cookbook is that you're using?

@agperson
Copy link
Author

I can confirm that the copy of the IIS cookbook is version 4.1.0 and depends on "windows", ">= 1.34.6". The version of the windows cookbook is 1.36.6

@btm
Copy link
Contributor

btm commented Mar 11, 2015

@agperson can you share a gist of a 'chef-client -l debug' output?

I made a fake cookbook that depended on iis, and running Chef 12.1.1 it properly loaded the windows cookbook first:

Compiling Cookbooks...
[2015-03-11T10:33:04-04:00] DEBUG: Cookbooks to compile: [:chef_handler, :windows, :iis, :"deps-iis"]
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/feature_base.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/matchers.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/powershell_helper.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/powershell_out.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/registry_helper.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/version.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/windows_architecture_helper.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/windows_helper.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/windows_package.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/windows_privileged.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook windows's library file: /var/chef/cache/cookbooks/windows/libraries/wmi_helper.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook iis's library file: /var/chef/cache/cookbooks/iis/libraries/helper.rb
[2015-03-11T10:33:04-04:00] DEBUG: Loading cookbook iis's library file: /var/chef/cache/cookbooks/iis/libraries/matcher.rb

@ksubrama ksubrama closed this as completed May 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants