Chef + NoMethodError undefined method `[]' for nil:NilClass


#1

I am new to Chef/DevOps - trying to install postgresql(5.1.0) on a windows node after downloading its dependencies. I am getting the following error

NoMethodError
-------------
undefined method `[]’ for nil:NilClass

Platform:
---------
i386-mingw32

[2016-12-12T10:37:22-05:00] DEBUG: Re-raising exception: NoMethodError - undefined method `[]' for nil:NilClass
C:/chef/cache/cookbooks/postgresql/recipes/client.rb:35:in `from_file'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `instance_eval'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `from_file'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/cookbook_version.rb:233:in `load_recipe'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context.rb:338:in `load_recipe'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context.rb:294:in `block in include_recipe'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context.rb:293:in `each'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context.rb:293:in `include_recipe'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
  C:/chef/cache/cookbooks/postgresql/recipes/server.rb:22:in `from_file'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `instance_eval'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/mixin/from_file.rb:30:in `from_file'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/cookbook_version.rb:233:in `load_recipe'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context.rb:338:in `load_recipe'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:141:in `block in compile_recipes'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/run_context.rb:187:in `load'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
  C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.16.42-universal-mingw32/lib/chef/client.rb:510:in `setup_run_context'

Then I found this SO on Berkshelf, based on that created a Berksfile

 cookbook "postgresql"

It downloaded only the following dependencies ‘compat_resources’,‘mingw’,‘ohai’,‘seven_zip’ and ‘windows’

Now I end up getting this error:

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
The following cookbooks are required by the client but don't exist on the server:
* apt
* build-essential
* openssl


Expanded Run List:
------------------
* postgresql::server

Platform:
---------
i386-mingw32

I looked at the metadata.json and could see that Windows is not listed as one of the supported platform. So is that the reason?

"platforms": {
"ubuntu": ">= 12.04",
"debian": ">= 7.0",
"opensuse": ">= 13.0",
"suse": ">= 12.0",
"fedora": ">= 0.0.0",
"opensuseleap": ">= 0.0.0",
"amazon": ">= 0.0.0",
"redhat": ">= 6.0",
"centos": ">= 6.0",
"scientific": ">= 6.0",
"oracle": ">= 6.0"

},
Need help in resolving this.


#2

I think u missed the berks upload