Question On An Error Using Vagrant & chef_client provisioner. Berkshelf issue


#1

Hey folks,

I’m spending a lot of time trying to figure Chef out. I’ve written a few cookbooks now and have been using test kitchen to run them in a VM. Now, I’m starting to practice using Vagrant against my cookbooks in a chef repo I generated using “chef generate repo” @ /Users/isuftin/Development/Chef/CIDA/.

I’ve gotten the chef_solo provisioner working properly and now I want to mess around with the chef_client provisioner with chef_zero since it will more closely reflect a real world environment.

The issue I am having is coming from Berkshelf during the provisioning process.

My Vagrantfile that sits in the root of my chef repo:
Vagrant.configure(2) do |config|
config.vm.box = "usgs-wsi-centos-6.6-vmware"
config.vm.define “stig_dev_client” do |stig_dev_client|
stig_dev_client.vm.provision :chef_client do |chef|
chef.chef_server_url = "http://192.168.1.5:9501"
chef.validation_key_path = ".chef/validation.pem"
end
end
end

Chef zero running:
$ chef-zero --host 192.168.1.5 --port 9501 -l debug

Starting Chef Zero (v3.2)…
WEBrick (v1.3.1) on Rack (v1.5) is listening at http://192.168.1.5:9501
Press CTRL+C to stop

The Berksfile in the root of my chef repo:
source "https://supermarket.getchef.com"
cookbook ‘stig’, path: 'cookbooks/stig’

My ~/.berkshelf/config.json
{
“chef” : {
“node_name” : “devhost”,
“client_key” : “/Users/isuftin/Development/Chef/CIDA/.chef/devhost.pem”
},
“cookbook” : {
“email” : "isuftin@usgs.gov"
}
}

$ vagrant up stig_dev_client —provision
stig_dev_client: The Berkshelf shelf is at “/Users/isuftin/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141226-75453-17kay76-stig_dev_client”
==> stig_dev_client: Attempting graceful shutdown of VM…
==> stig_dev_client: Verifying vmnet devices are healthy…
==> stig_dev_client: Updating Vagrant’s Berkshelf…
==> stig_dev_client: Resolving cookbook dependencies…
==> stig_dev_client: Fetching ‘stig’ from source at cookbooks/stig
==> stig_dev_client: Using auditd (0.1.4)
==> stig_dev_client: Using stig (0.1.0) from source at cookbooks/stig
==> stig_dev_client: Vendoring auditd (0.1.4) to /Users/isuftin/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141226-75453-17kay76-stig_dev_client/auditd
==> stig_dev_client: Vendoring stig (0.1.0) to /Users/isuftin/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141226-75453-17kay76-stig_dev_client/stig
/Users/isuftin/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.1/lib/vagrant-berkshelf/action/upload.rb:61:in ensure in with_provision_berkshelf_config': undefined methodclose’ for nil:NilClass (NoMethodError)
from /Users/isuftin/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.1/lib/vagrant-berkshelf/action/upload.rb:62:in with_provision_berkshelf_config' from /Users/isuftin/.vagrant.d/gems/gems/vagrant-berkshelf-4.0.1/lib/vagrant-berkshelf/action/upload.rb:85:inblock in upload’
[…]

It looks like the issue is here:

I know I should probably just turn berkshelf off here anyway by adding stig_dev_client.berkshelf.enabled = false to my machine definition block because chef-zero will deal with all of the dependencies here but I’ve not read any blogs or instructions that this shouldn’t work and even in the Berkshelf documentation, they show us how to work with chef_client provisioner.

When I do turn berkshelf off for this, it does work fine.
__________________________ (╯°□°)╯︵ ┻━┻
Ivan Suftin - Applications Developer - isuftin@usgs.gov
Office: (608) 821-3825 - Cell : (608) 345-8963
Center for Integrated Data Analytics - http://cida.usgs.gov/
United States Geological Survey
8505 Research Way, Middleton, WI 53562