Vagrant / Berkshelf /Chef Solo

Chef solo cannot find my local cookbooks. I must be doing something stupid.
Any help appreciated :slight_smile:

I have berkshelf setup ok with the following in my VagrantFile

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "starter"
end

$ tree cookbooks/getting-started/
cookbooks/getting-started/
β”œβ”€β”€ README.rdoc
β”œβ”€β”€ attributes
β”‚ └── default.rb
β”œβ”€β”€ metadata.json
β”œβ”€β”€ metadata.rb
β”œβ”€β”€ recipes
β”‚ └── default.rb
└── templates
└── default
└── chef-getting-started.txt.erb

If I run $ vagrant up I get:

[2013-11-25T14:55:58+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
[β€œrecipe[starter]”] from JSON
[2013-11-25T14:55:59+00:00] INFO: Run List is [recipe[starter]]

[2013-11-25T14:55:59+00:00] ERROR: Running exception handlers
[2013-11-25T14:55:59+00:00] ERROR: Exception handlers complete
[2013-11-25T14:55:59+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-25T14:55:59+00:00] FATAL: Chef::Exceptions::CookbookNotFound:
Cookbook starter not found. If you’re loading starter from another
cookbook, make sure you configure the dependency in your metadata

But if I run against a berkshelf cookbook e.g. (VagrantFile)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
end

my VM gets provioned ok

Thanks
Rob

Can you post your metadata.rb and your Berksfile?

On Mon, Nov 25, 2013 at 9:34 AM, Rob Watkin robwatkin@gmail.com wrote:

Chef solo cannot find my local cookbooks. I must be doing something
stupid. Any help appreciated :slight_smile:

I have berkshelf setup ok with the following in my VagrantFile

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "starter"
end

$ tree cookbooks/getting-started/
cookbooks/getting-started/
β”œβ”€β”€ README.rdoc
β”œβ”€β”€ attributes
β”‚ └── default.rb
β”œβ”€β”€ metadata.json
β”œβ”€β”€ metadata.rb
β”œβ”€β”€ recipes
β”‚ └── default.rb
└── templates
└── default
└── chef-getting-started.txt.erb

If I run $ vagrant up I get:

[2013-11-25T14:55:58+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
["recipe[starter]"] from JSON
[2013-11-25T14:55:59+00:00] INFO: Run List is [recipe[starter]]

[2013-11-25T14:55:59+00:00] ERROR: Running exception handlers
[2013-11-25T14:55:59+00:00] ERROR: Exception handlers complete
[2013-11-25T14:55:59+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-25T14:55:59+00:00] FATAL: Chef::Exceptions::CookbookNotFound:
Cookbook starter not found. If you're loading starter from another
cookbook, make sure you configure the dependency in your metadata

But if I run against a berkshelf cookbook e.g. (VagrantFile)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
end

my VM gets provioned ok

Thanks
Rob

did you try running "berks install" before the vagrant up ?

On Mon, Nov 25, 2013 at 8:51 AM, Nic Grayson nic.grayson@banno.com wrote:

Can you post your metadata.rb and your Berksfile?

On Mon, Nov 25, 2013 at 9:34 AM, Rob Watkin robwatkin@gmail.com wrote:

Chef solo cannot find my local cookbooks. I must be doing something
stupid. Any help appreciated :slight_smile:

I have berkshelf setup ok with the following in my VagrantFile

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "starter"
end

$ tree cookbooks/getting-started/
cookbooks/getting-started/
β”œβ”€β”€ README.rdoc
β”œβ”€β”€ attributes
β”‚ └── default.rb
β”œβ”€β”€ metadata.json
β”œβ”€β”€ metadata.rb
β”œβ”€β”€ recipes
β”‚ └── default.rb
└── templates
└── default
└── chef-getting-started.txt.erb

If I run $ vagrant up I get:

[2013-11-25T14:55:58+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
["recipe[starter]"] from JSON
[2013-11-25T14:55:59+00:00] INFO: Run List is [recipe[starter]]

[2013-11-25T14:55:59+00:00] ERROR: Running exception handlers
[2013-11-25T14:55:59+00:00] ERROR: Exception handlers complete
[2013-11-25T14:55:59+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-25T14:55:59+00:00] FATAL: Chef::Exceptions::CookbookNotFound:
Cookbook starter not found. If you're loading starter from another
cookbook, make sure you configure the dependency in your metadata

But if I run against a berkshelf cookbook e.g. (VagrantFile)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
end

my VM gets provioned ok

Thanks
Rob

Hi Nic,

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned
without explicitly naming them?

Thanks again :slight_smile:
Rob

#Berksfile
cookbook "starter", :path => "cookbooks/starter"

#cookbooks/starter/metadata.rb
name 'starter'
description 'A basic starter cookbook'
version '1.0.0'

On 25 November 2013 15:51, Nic Grayson nic.grayson@banno.com wrote:

Can you post your metadata.rb and your Berksfile?

On Mon, Nov 25, 2013 at 9:34 AM, Rob Watkin robwatkin@gmail.com wrote:

Chef solo cannot find my local cookbooks. I must be doing something
stupid. Any help appreciated :slight_smile:

I have berkshelf setup ok with the following in my VagrantFile

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "starter"
end

$ tree cookbooks/getting-started/
cookbooks/getting-started/
β”œβ”€β”€ README.rdoc
β”œβ”€β”€ attributes
β”‚ └── default.rb
β”œβ”€β”€ metadata.json
β”œβ”€β”€ metadata.rb
β”œβ”€β”€ recipes
β”‚ └── default.rb
└── templates
└── default
└── chef-getting-started.txt.erb

If I run $ vagrant up I get:

[2013-11-25T14:55:58+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
["recipe[starter]"] from JSON
[2013-11-25T14:55:59+00:00] INFO: Run List is [recipe[starter]]

[2013-11-25T14:55:59+00:00] ERROR: Running exception handlers
[2013-11-25T14:55:59+00:00] ERROR: Exception handlers complete
[2013-11-25T14:55:59+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-25T14:55:59+00:00] FATAL: Chef::Exceptions::CookbookNotFound:
Cookbook starter not found. If you're loading starter from another
cookbook, make sure you configure the dependency in your metadata

But if I run against a berkshelf cookbook e.g. (VagrantFile)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
end

my VM gets provioned ok

Thanks
Rob

Yes I did 'berks install'

On 25 November 2013 16:11, Ryan Kelley rykelley@gmail.com wrote:

did you try running "berks install" before the vagrant up ?

On Mon, Nov 25, 2013 at 8:51 AM, Nic Grayson nic.grayson@banno.comwrote:

Can you post your metadata.rb and your Berksfile?

On Mon, Nov 25, 2013 at 9:34 AM, Rob Watkin robwatkin@gmail.com wrote:

Chef solo cannot find my local cookbooks. I must be doing something
stupid. Any help appreciated :slight_smile:

I have berkshelf setup ok with the following in my VagrantFile

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "starter"
end

$ tree cookbooks/getting-started/
cookbooks/getting-started/
β”œβ”€β”€ README.rdoc
β”œβ”€β”€ attributes
β”‚ └── default.rb
β”œβ”€β”€ metadata.json
β”œβ”€β”€ metadata.rb
β”œβ”€β”€ recipes
β”‚ └── default.rb
└── templates
└── default
└── chef-getting-started.txt.erb

If I run $ vagrant up I get:

[2013-11-25T14:55:58+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
["recipe[starter]"] from JSON
[2013-11-25T14:55:59+00:00] INFO: Run List is [recipe[starter]]

[2013-11-25T14:55:59+00:00] ERROR: Running exception handlers
[2013-11-25T14:55:59+00:00] ERROR: Exception handlers complete
[2013-11-25T14:55:59+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-25T14:55:59+00:00] FATAL: Chef::Exceptions::CookbookNotFound:
Cookbook starter not found. If you're loading starter from another
cookbook, make sure you configure the dependency in your metadata

But if I run against a berkshelf cookbook e.g. (VagrantFile)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
end

my VM gets provioned ok

Thanks
Rob

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin robwatkin@gmail.com wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale

http://twitter.com/andygale

The idea behind Berkshelf is that you shouldn't use your local cookbooks.
You should pull them from git, a chef api, opscode, etc. Setup Berkshelf to
pull from the default location where they are and berks install.

On Mon, Nov 25, 2013 at 10:15 AM, Andy Gale andy@salgo.net wrote:

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin robwatkin@gmail.com wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned
without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

I was just trying to be able to create new local cookbooks in a dev
environment

On 25 November 2013 16:44, Nic Grayson nic.grayson@banno.com wrote:

The idea behind Berkshelf is that you shouldn't use your local cookbooks.
You should pull them from git, a chef api, opscode, etc. Setup Berkshelf to
pull from the default location where they are and berks install.

On Mon, Nov 25, 2013 at 10:15 AM, Andy Gale andy@salgo.net wrote:

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin robwatkin@gmail.com wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned
without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

I’m not sure if this will work, but have you tried to stick β€˜path β€œ/path/to/cookbooks”’ at the top of the Berksfile?

--Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On Monday, November 25, 2013 at 14:53, Rob Watkin wrote:

I was just trying to be able to create new local cookbooks in a dev environment

On 25 November 2013 16:44, Nic Grayson <nic.grayson@banno.com (mailto:nic.grayson@banno.com)> wrote:

The idea behind Berkshelf is that you shouldn't use your local cookbooks. You should pull them from git, a chef api, opscode, etc. Setup Berkshelf to pull from the default location where they are and berks install.

On Mon, Nov 25, 2013 at 10:15 AM, Andy Gale <andy@salgo.net (mailto:andy@salgo.net)> wrote:

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin <robwatkin@gmail.com (mailto:robwatkin@gmail.com)> wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Hi Rob,

Your tree output suggests that your cookbook is called "getting-started",
while your Vagrant config refers to a cookbook called "starter". You can
see that in the Chef output:

[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
["recipe[starter]"] from JSON

Changing your chef.add_recipe to "getting-started" should do what you
expect.

Zac

On Mon, Nov 25, 2013 at 3:34 PM, Rob Watkin robwatkin@gmail.com wrote:

Chef solo cannot find my local cookbooks. I must be doing something
stupid. Any help appreciated :slight_smile:

I have berkshelf setup ok with the following in my VagrantFile

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "starter"
end

$ tree cookbooks/getting-started/
cookbooks/getting-started/
β”œβ”€β”€ README.rdoc
β”œβ”€β”€ attributes
β”‚ └── default.rb
β”œβ”€β”€ metadata.json
β”œβ”€β”€ metadata.rb
β”œβ”€β”€ recipes
β”‚ └── default.rb
└── templates
└── default
└── chef-getting-started.txt.erb

If I run $ vagrant up I get:

[2013-11-25T14:55:58+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-25T14:55:59+00:00] INFO: Setting the run_list to
["recipe[starter]"] from JSON
[2013-11-25T14:55:59+00:00] INFO: Run List is [recipe[starter]]

[2013-11-25T14:55:59+00:00] ERROR: Running exception handlers
[2013-11-25T14:55:59+00:00] ERROR: Exception handlers complete
[2013-11-25T14:55:59+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-11-25T14:55:59+00:00] FATAL: Chef::Exceptions::CookbookNotFound:
Cookbook starter not found. If you're loading starter from another
cookbook, make sure you configure the dependency in your metadata

But if I run against a berkshelf cookbook e.g. (VagrantFile)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apache2"
end

my VM gets provioned ok

Thanks
Rob

Hi Cassiano,

I just tried that and got:
Berkshelf::BerksfileReadError: An error occurred while reading the
Berksfile:
undefined method `path' for #<#Class:0x0000010538bd40:0x0000010538b9f8>

I'm trying to set up the cookbook library wrapper pattern following:

and
http://support.rightscale.com/12-Guides/Chef_Cookbooks_Developer_Guide/04-Developer/06-Development_Resources/Chef_Cookbook_Design_Patterns/Wrapper_Cookbook_Pattern

So I need chef solo to find my 'local cookbooks'.

On 25 November 2013 17:07, Cassiano Leal cassianoleal@gmail.com wrote:

I’m not sure if this will work, but have you tried to stick β€˜path
β€œ/path/to/cookbooks”’ at the top of the Berksfile?

--
Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On Monday, November 25, 2013 at 14:53, Rob Watkin wrote:

I was just trying to be able to create new local cookbooks in a dev
environment

On 25 November 2013 16:44, Nic Grayson nic.grayson@banno.com wrote:

The idea behind Berkshelf is that you shouldn't use your local cookbooks.
You should pull them from git, a chef api, opscode, etc. Setup Berkshelf to
pull from the default location where they are and berks install.

On Mon, Nov 25, 2013 at 10:15 AM, Andy Gale andy@salgo.net wrote:

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin robwatkin@gmail.com wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned
without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

I understand your pain. Having been there, the way I solved it was to name each of the dependencies on the Berksfile as you have already figured out, and I agree it’s a pain.

Maybe open a feature request for the plugin [1] ?

[1] Issues Β· berkshelf/vagrant-berkshelf Β· GitHub

--Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On Monday, November 25, 2013 at 15:23, Rob Watkin wrote:

Hi Cassiano,

I just tried that and got:
Berkshelf::BerksfileReadError: An error occurred while reading the Berksfile:
undefined method `path' for #<#Class:0x0000010538bd40:0x0000010538b9f8>

I'm trying to set up the cookbook library wrapper pattern following:
Getting Started Writing Chef Cookbooks the Berkshelf Way, Part 1 - Mischa Taylor's Coding Blog
and
http://support.rightscale.com/12-Guides/Chef_Cookbooks_Developer_Guide/04-Developer/06-Development_Resources/Chef_Cookbook_Design_Patterns/Wrapper_Cookbook_Pattern

So I need chef solo to find my 'local cookbooks'.

On 25 November 2013 17:07, Cassiano Leal <cassianoleal@gmail.com (mailto:cassianoleal@gmail.com)> wrote:

I’m not sure if this will work, but have you tried to stick β€˜path β€œ/path/to/cookbooks”’ at the top of the Berksfile?

--Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On Monday, November 25, 2013 at 14:53, Rob Watkin wrote:

I was just trying to be able to create new local cookbooks in a dev environment

On 25 November 2013 16:44, Nic Grayson <nic.grayson@banno.com (mailto:nic.grayson@banno.com)> wrote:

The idea behind Berkshelf is that you shouldn't use your local cookbooks. You should pull them from git, a chef api, opscode, etc. Setup Berkshelf to pull from the default location where they are and berks install.

On Mon, Nov 25, 2013 at 10:15 AM, Andy Gale <andy@salgo.net (mailto:andy@salgo.net)> wrote:

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin <robwatkin@gmail.com (mailto:robwatkin@gmail.com)> wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

Thanks Cassiano, I might do that when I have a better idea of how to frame
it. At the moment I'm just trying to get the 'perfect' setup before I begin
(getting lost in the complexities of) my sites cookbook development.

On 25 November 2013 17:28, Cassiano Leal cassianoleal@gmail.com wrote:

I understand your pain. Having been there, the way I solved it was to name
each of the dependencies on the Berksfile as you have already figured out,
and I agree it’s a pain.

Maybe open a feature request for the plugin [1] ?

[1] Issues Β· berkshelf/vagrant-berkshelf Β· GitHub

--
Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On Monday, November 25, 2013 at 15:23, Rob Watkin wrote:

Hi Cassiano,

I just tried that and got:
Berkshelf::BerksfileReadError: An error occurred while reading the
Berksfile:
undefined method `path' for #<#Class:0x0000010538bd40:0x0000010538b9f8>

I'm trying to set up the cookbook library wrapper pattern following:

Getting Started Writing Chef Cookbooks the Berkshelf Way, Part 1 - Mischa Taylor's Coding Blog
and

http://support.rightscale.com/12-Guides/Chef_Cookbooks_Developer_Guide/04-Developer/06-Development_Resources/Chef_Cookbook_Design_Patterns/Wrapper_Cookbook_Pattern

So I need chef solo to find my 'local cookbooks'.

On 25 November 2013 17:07, Cassiano Leal cassianoleal@gmail.com wrote:

I’m not sure if this will work, but have you tried to stick β€˜path
β€œ/path/to/cookbooks”’ at the top of the Berksfile?

--
Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On Monday, November 25, 2013 at 14:53, Rob Watkin wrote:

I was just trying to be able to create new local cookbooks in a dev
environment

On 25 November 2013 16:44, Nic Grayson nic.grayson@banno.com wrote:

The idea behind Berkshelf is that you shouldn't use your local cookbooks.
You should pull them from git, a chef api, opscode, etc. Setup Berkshelf to
pull from the default location where they are and berks install.

On Mon, Nov 25, 2013 at 10:15 AM, Andy Gale andy@salgo.net wrote:

On Mon, Nov 25, 2013 at 4:12 PM, Rob Watkin robwatkin@gmail.com wrote:

Thanks for your help. I just changed the Berksfile as shown below and it
works fine. Is there anyway I can get all my local cookbooks scanned
without
explicitly naming them?

I think that the plugin overrides the cookbook_path variable so "no"
is the answer. From http://berkshelf.com/

"Chef Solo provisioner

The Chef Solo provisioner’s cookbook_path attribute is hijacked when
using the Vagrant Berkshelf plugin. Cookbooks resolved from your
Berksfile will automatically be made available to your Vagrant virtual
machine. There is no need to explicitly set a value for cookbook_path
attribute."

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale