[chef] Re: Re: Re: Re: Hack: berkshelf 1.3 and vagrant 1.0


Chronological Thread 
  • From: Sascha Bates < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Hack: berkshelf 1.3 and vagrant 1.0
  • Date: Thu, 28 Mar 2013 14:57:03 -0500

I just ran through a Berksfile test and am seeing the same thing. I changed one thing in the Vagrant file and that was to use a local centos6.3 box I already had instead of downloading another box. Otherwise it was plain vanilla Berkshelf with only the local cookbook I was testing, no external deps.

To fix:
I added into the Vagrantfile: chef.cookbooks_path = "/Users/sascha/pathto/cookbooks" to the provisioning section and that fixed it.

I've had the same problem with test-kitchen's vagrant plugin as well so I'm wondering if there's something different with new Vagrant and how it's doing cookbook path discovery?

" type="cite">
" photoname="Andrew Hollingsworth" src="jpglKxtTGY8xp.jpg" name="compose-unknown-contact.jpg" height="25px" width="25px">
March 28, 2013 1:06 PM
Hi Mark,

I had a similar problem and it turned out to be the way my client was
abstracting their box configuration similar to the following :


Vagrant.configure("2") do |config|
config.vm.box_url =
"http://mirrors.example.com/vagrant/boxes/ubuntu-12.04-x86_64.box"
config.vm.synced_folder "srv", "/srv", "/srv"

config.vm.define :mybox do |mybox_config|
mybox_config.vm.box = "mybox.dev"

<snip but everything defined around mybox_config (instead of just config)>

end
end


Instead of just using a more standard setup like :

Vagrant.configure("2") do |config|

config.vm.box_url =
"http://mirrors.example.com/vagrant/boxes/ubuntu-12.04-x86_64.box"
config.vm.synced_folder "/srv", "/srv", :nfs => true

config.vm.box = "mybox.dev"

config.vm.network :private_network, ip: "192.168.12.23"
config.vm.network :forwarded_port, guest: 22, host: 2322

<snip - all other definitions etc.>

end

Having the extra abstraction for mybox_config prevented berkshelf from
working correctly for some reason. Changing to the standard way fixed
my problem.

Thought it was worth mentioning in case your Vagrantfile is similarly setup.

Cheers

adh
--
Andrew Hollingsworth
">

" photoname="Mark Pimentel" src="jpglKxtTGY8xp.jpg" name="compose-unknown-contact.jpg" height="25px" width="25px">
March 28, 2013 8:58 AM
I still cannot get vagrant provision to work with chef-solo.  I followed your upgrade steps below, and then ran ....

vagrant up
vagrant provision

On the up command it brings up the vagrant box as expected.
On the provision step, it invokes the berkshelf plugin to download all the cookbooks as defined the Berksfile to some isolated directory for this vagrant box.  But then when it runs the actual chef-solo run, it cannot find any cookbooks.  Am I missing something here?  Shouldn't the berkshelf plugin somehow be injecting the path or creating a shared folder to the isolated download directory so chef-solo in the VM can find its cookbooks?

On 2013-03-26 12:08 PM, Andrew Gross wrote:

" photoname="Andrew Gross" src="jpglKxtTGY8xp.jpg" name="compose-unknown-contact.jpg" height="25px" width="25px">
March 26, 2013 11:08 AM
I managed to get the upgrade working, was a little bit of a struggle.  

General Steps
1. Install new Vagrant DMG (on mac)
2. Uninstall Vagrant Gem (from system, rvm, bundler whatever)
3. Install Berkshelf Vagrant Plugin (`vagrant plugin install berkshelf-vagrant`)
4. Upgrade Berkshelf Gem to 1.3.*
5. Rerun Berks install
6. Remove any 'require Berkshelf' sections from my Vagrantfile
7. Remove references to 'config.berkshelf.berksfile_path' from Vagrantfile

Notes:
`vagrant up` seems to not do a `vagrant provision` automatically, so now I have to chain the commands.

The `.vagrant` file is now actually a folder, so make sure to use rm -rf to clean up afterwards.

Granted my Vagrantfiles are very simple, so there may be more conversion needed.

Andrew



" photoname="Brian Akins" src="jpglKxtTGY8xp.jpg" name="compose-unknown-contact.jpg" height="25px" width="25px">
March 26, 2013 9:09 AM
I had so many issues with upgrading Vagrant that I decided to go back
to 1.0 for now. I needed Berkshelf integration. I could not get the
"new" berkshelf-vagrant to work with vagrant 1.0, but that may be just
me.

So, here's my hack that others may find helpful - if only as comedic relief:

https://github.com/bakins/berkshelf-hobo



Archive powered by MHonArc 2.6.16.

§