2
votes

I've recently been attempting to use Chef to provision my local development environment, however I am unable to get Chef to recognize where cookbooks are located. I am wondering if anyone can help shed some light on what it is I am missing?

I have been running chef-solo from the folder where I have set everything up using the following command:

chef-solo -c solo.rb

This produces the following output:

Starting Chef Client, version 12.4.1 Compiling Cookbooks...

Running handlers: [2015-07-31T11:52:26+01:00] ERROR: Running exception handlers Running handlers complete [2015-07-31T11:52:26+01:00] ERROR: Exception handlers complete Chef Client failed. 0 resources updated in 14.12488 seconds [2015-07-31T11:52:26+01:00] FATAL: Stacktrace dumped to c:/chef/chef-stacktrace.out [2015-07-31T11:52:26+01:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook sublime-text not found. If you're loading sublime-text from another cookbook, ma ke sure you configure the dependency in your metadata

I have however specified where to find the cookbooks in the solo.rb file, which looks as follows:

root = File.absolute_path(File.dirname(__FILE__))

file_cache_path root
cookbook_path root + "/cookbooks"
json_attribs root + "/solo.json"

And the solo.json file looks as follows:

{
    "run_list": [
        "recipe[sublime-text::default]"
    ]
}

The folder structure is as follows:

Chef
  -- cookbooks
     -- sublime-text
  -- solo.json
  -- solo.rb

Is there something I am missing to specify the path to the cookbooks properly? Or even better, is this even the correct way to go about provisioning one machine using chef-solo?

Many thanks.

1

1 Answers

1
votes

I would rather use chef-client in local mode - I had problems with solo with cookbooks, too.

If you want to know, how to use chef-client, here is command:

  C:\opscode\chef\bin\chef-client --local -j run_list.json

I run this from directory with cookbooks:

 Script
   - run_list.json
   - cookbooks
      - windows-master
      - chef_handler
      - my_cookbook

Remember to run this script from "Script" directory.