Beardee
Beardee

Reputation: 61

Cookbook not found after Yum Update

I am trying to use an Opsworks formatted cookbook repository with Vagrant and Berkshelf locally for testing and local VMs using this article:

http://dev.inventit.io/blog/aws/opsworks/vagrant/chef/berkshelf/2014/04/28/opsworks_vagrant_chef_berkshelf_tips.html

Everything works, until I reboot. After that, when I run vagrant provision to test again, I get "cookbook not found" for what is in my Berksfile.

Here are the relevant portions of my Vagrantfile:

config.omnibus.chef_version = "11.4.0"

config.vm.box = "chef/centos-6.5"

config.vm.provider "virtualbox" do |vb|
  vb.memory = "1024"
end

config.berkshelf.enabled = true

config.vm.provision "shell", inline: <<-SHELL
    rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
    sudo yum -y update
SHELL

config.vm.provision :chef_solo do |chef|
    eval run_list
    chef.json = json
end

config.vbguest.auto_update = true

Here is my Berksfile:

#!/usr/bin/env ruby
# -*- encoding : utf-8 -*-

source "https://api.berkshelf.com"
cookbook 'cookbookname', path: "cookbookname"

My Vagrant plugins: vagrant-berkshelf (4.0.3) vagrant-omnibus (1.4.1) vagrant-share (1.1.3, system) vagrant-vbguest (0.10.0)

As noted, this works fine prior to rebooting. CentOS does get bumped from 6.5 to 6.6 with the yum update, which is finalized on reboot.

Any assistance would be appreciated.

Follow up:

After more research I was able to find the point of failure and get this to run by manually moving some files around.

On the reboot after the yum update, guest additions is updated (successfully) from 4.3.8 to 4.3.20.

I can see the Berkshelf plugin vendors all my cookbooks on the host:

 ==> default: Vendoring yum (3.5.3) to /root/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150223-32730-2aw62c-default/yum
==> default: Vendoring yum-epel (0.6.0) to /root/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150223-32730-2aw62c-default/yum-epel

I can access /vagrant and see all the shared files.

If I look in /tmp/vagrant-chef I can see the run list and json file, but the cookbooks directory is empty. I run provision again and it stays empty.

If I copy everything in the host vendored cookbooks directory to here and rerun provision, success! I am continuing to research why the vagrant-berkshelf plugin would fail to upload. Any help would still be appreciated.

Upvotes: 1

Views: 295

Answers (1)

Beardee
Beardee

Reputation: 61

Found this is a known bug in the Vagrant 1.7.2 core code:

https://github.com/mitchellh/vagrant/issues/5199

I did not get any of the short workarounds (delete the synced_folders & run vagrant reload) to work but simply downgrading to vagrant 1.7.1 did the trick.

Upvotes: 3

Related Questions