berkshelf / vagrant-berkshelf

A Vagrant plugin to add Berkshelf integration to the Chef provisioners
Other
379 stars 100 forks source link

Setup actions after config validation #249

Closed evverx closed 9 years ago

evverx commented 9 years ago

berkshelf_enabled?(env) works incorrect before config validation. For example, share action synced empty berkshelf directory if I have no Berksfile in project directory and I don't set berksfile.enable to true, because @enable attribute has MAYBE value before validation.

evverx commented 9 years ago

You can reproduce bug with Vagrantfile:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.provision :chef_zero do |chef|
    chef.add_recipe :hello
  end
end
› tree
.
└── Vagrantfile
vagrant-berkshelf (4.0.1)
Vagrant 1.7.1
Berks 3.2.1
Chef Development Kit Version: 0.3.5

vagrant up

› vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
    default: The Berkshelf shelf is at "/Users/evvers/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141231-10314-b23kcs-default"
==> default: Sharing cookbooks with VM
==> default: Importing base box 'ubuntu/trusty64'...
...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /Users/evvers/Vagrant/vagrant-berkshelf-bug
    default: /tmp/vagrant-chef-4/chef-solo-1/cookbooks => /Users/evvers/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141231-10531-zvqwl3-default
==> default: Running provisioner: chef_zero...
sethvargo commented 9 years ago

Thanks!

tknerr commented 9 years ago

Argh, this bit me just in two different instances after updating to 4.0.2 where I had Vagrant projects with no Berksfile present.

Looks like this was just merged to master right after the 4.0.2 release.

@reset @sethvargo mind a followup 4.0.3 release?