How to automate chef gem installation?. while running cookbook ‘windows’ (github) I’m getting error “cannot load such file – ruby-wmi” due to gems files are not installed. Is there any way to automate this instead of manually installing chef gems.( I didn’t have internet access in my server)
Thanks
Do you mind including a stacktrace? I’d be curious to see where ruby-wmi is being required.
Generated at 2016-10-28 14:17:30 +0530
LoadError: cannot load such file – ruby-wmi
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' C:/opscode/chef/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
require’
c:/chef/cache/cookbooks/windows/libraries/registry_helper.rb:27:in <top (required)>' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:192:in
load’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:192:in block in load_libraries_from_cookbook' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:188:in
each’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:188:in load_libraries_from_cookbook' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:99:in
block in compile_libraries’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:98:in each' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:98:in
compile_libraries’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:71:in compile' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/run_context.rb:176:in
load’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:97:in setup_run_context' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/client.rb:510:in
setup_run_context’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/client.rb:280:in run' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application.rb:284:in
run_with_graceful_exit_option’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application.rb:260:in block in run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/local_mode.rb:44:in
with_server_connectivity’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application.rb:243:in run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application/client.rb:464:in
sleep_then_run_chef_client’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application/client.rb:451:in block in interval_run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application/client.rb:450:in
loop’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application/client.rb:450:in interval_run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application/client.rb:434:in
run_application’
C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/lib/chef/application.rb:60:in run' C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.13.37-universal-mingw32/bin/chef-client:26:in
<top (required)>'
C:/opscode/chef/bin/chef-client:64:in load' C:/opscode/chef/bin/chef-client:64:in
’
cookbook link https://github.com/chef-cookbooks/windows
I think you may be using a very old version of the windows cookbook that used to depend on ruby-wmi. That dependency was removed a couple years ago to avoid this same scenario.