0

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.

Community
  • 1
  • 1
patb23
  • 387
  • 5
  • 21
  • 2
    This is a very broad question. If you are just starting out with Chef please run through our tutorials at learn.chef.io – coderanger Dec 13 '16 at 04:26
  • This is just an opinion, but found versions of the `postgresql` cookbook greater than version 3 don't work very well. Are you setting new defaults or overrides on any postgresql cookbook attributes? – Derek Dec 13 '16 at 09:26
  • Best to spend some time at learn.chef.io as @coderanger said. It sounds like you might be in between workflows. You'll first need to determine what workflow you want to use with chef - chef server based (nodes are bootstrapped and cookbooks are uploaded) or chef solo based (cookbooks are on local disk and no chef server is setup) and then run the client with or without the --local-mode flag accordingly. – kellyb Dec 13 '16 at 10:13
  • @coderanger, as advised, learning to setup a webapp in local mode -as I am already running linux on a VM with shared memory, not able to complete the step. Anyhow, I have updated my question with content of metadata.json. Can I assume that the postgresql available, doesn't support windows? Thanks. In my Ubuntu desktop, it is much better as i am getting an error at later stage, in postgres:client not able to connect to server. – patb23 Dec 14 '16 at 20:02
  • The specific error is you need to upload the dependencies for the cookbook, something `berks upload` and `chef push` do for you but `knife` does not (by default). More generally, yes the cookbook has no windows support so it won't work even if you fix that. – coderanger Dec 15 '16 at 19:07

0 Answers0