chef-provisioning-vagrant
chef-provisioning-vagrant copied to clipboard
vagrant_box throws undefined method `has_key?' for nil:NilClass
When I run this code:
require 'chef/provisioning/vagrant_driver'
with_driver 'vagrant'
vagrant_box 'opscode-centos-6.5' do
url 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/vmware/opscode_centos-6.5_chef-provisionerless.box'
vagrant_provider 'vmware_desktop'
end
I get this error:
================================================================================
Error executing action `create` on resource 'vagrant_box[opscode-centos-6.5]'
================================================================================
NoMethodError
-------------
undefined method `has_key?' for nil:NilClass
Resource Declaration:
---------------------
# In /Users/thomaspetchel/Development/learnchef/learn-chef-acceptance/acceptance/learn-the-basics-rhel/.acceptance/acceptance-cookbook/tmp/.chef/local-mode-cache/cache/cookbooks/acceptance-cookbook/recipes/provision.rb
8: vagrant_box 'opscode-centos-6.5' do
9: url 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/vmware/opscode_centos-6.5_chef-provisionerless.box'
10: vagrant_provider 'vmware_desktop'
11: end
12:
Compiled Resource:
------------------
# Declared in /Users/thomaspetchel/Development/learnchef/learn-chef-acceptance/acceptance/learn-the-basics-rhel/.acceptance/acceptance-cookbook/tmp/.chef/local-mode-cache/cache/cookbooks/acceptance-cookbook/recipes/provision.rb:8:in `from_file'
vagrant_box("opscode-centos-6.5") do
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :vagrant_box
cookbook_name "acceptance-cookbook"
recipe_name "provision"
url "http://opscode-vm-bento.s3.amazonaws.com/vagrant/vmware/opscode_centos-6.5_chef-provisionerless.box"
vagrant_provider "vmware_desktop"
end
I'm running this from a chef-acceptance
harness, and the stacktrace doesn't seem to show anything of value. Perhaps someone can verify the issue and get a better trace.
Ran chef-client -z -c /Users/thomaspetchel/Development/learnchef/learn-chef-acceptance/acceptance/learn-the-basics-rhel/.acceptance/acceptance-cookbook/tmp/.chef/config.rb -j /Users/thomaspetchel/Development/learnchef/learn-chef-acceptance/acceptance/learn-the-basics-rhel/.acceptance/acceptance-cookbook/tmp/dna.json -o acceptance-cookbook::provision returned 1
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/gems/mixlib-shellout-2.2.5/lib/mixlib/shellout.rb:276:in `error!'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/gems/chef-acceptance-0.2.0/lib/chef-acceptance/chef_runner.rb:57:in `block in execute_run_command'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler.rb:245:in `block in with_clean_env'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler.rb:232:in `with_original_env'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler.rb:238:in `with_clean_env'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/gems/chef-acceptance-0.2.0/lib/chef-acceptance/chef_runner.rb:50:in `execute_run_command'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/gems/chef-acceptance-0.2.0/lib/chef-acceptance/chef_runner.rb:24:in `run'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/gems/chef-acceptance-0.2.0/lib/chef-acceptance/cli.rb:19:in `block (2 levels) in <class:Cli>'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/gems/chef-acceptance-0.2.0/bin/chef-acceptance:6:in `<top (required)>'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/bin/chef-acceptance:23:in `load'
from /Users/thomaspetchel/.chefdk/gem/ruby/2.1.0/bin/chef-acceptance:23:in `<main>'
Work-around:
As a work-around, I manually did a vagrant box add ...
and was able to use a machine
resource to bring up an instance.
Other details:
Chef DK version:
$ chef --version
Chef Development Kit Version: 0.10.0
chef-client version: 12.5.1
berks version: 4.0.1
kitchen version: 1.4.2
vagrant-vmware-fusion
is installed an has a valid license key.
$ vagrant plugin list
vagrant-omnibus (1.4.1)
vagrant-share (1.1.5, system)
vagrant-vbguest (0.11.0)
vagrant-vmware-fusion (4.0.5)
vagrant-winrm (0.7.0)
This happened to me, looks like it occurs when there are no Vagrant boxes installed locally.
lib/chef/provider/vagrant_box.rb:52 is where it occurs.
This affects me too.
-------------
undefined method `has_key?' for nil:NilClass
Resource Declaration:
---------------------
# In /home/sam/Projects/vistacore/.chef/local-mode-cache/cache/cookbooks/machine/providers/boot.rb
78: vagrant_box 'opscode-centos-6.5' do
79: url 'https://xxxx/repositories/filerepo/third-party/program/opscode/centos/6.5/centos-6.5-provisionerless.box'
80: end
81: