diff --git a/lib/vagrant/provisioners/chef_server.rb b/lib/vagrant/provisioners/chef_server.rb index f10c84492..7f7053600 100644 --- a/lib/vagrant/provisioners/chef_server.rb +++ b/lib/vagrant/provisioners/chef_server.rb @@ -6,7 +6,7 @@ module Vagrant def prepare if env.config.chef.validation_key_path.nil? raise Actions::ActionException.new(:chef_server_validation_key_required) - elsif !File.file?(env.config.chef.validation_key_path) + elsif !File.file?(validation_key_path) raise Actions::ActionException.new(:chef_server_validation_key_doesnt_exist) end diff --git a/test/vagrant/provisioners/chef_server_test.rb b/test/vagrant/provisioners/chef_server_test.rb index 200660384..d2008dfab 100644 --- a/test/vagrant/provisioners/chef_server_test.rb +++ b/test/vagrant/provisioners/chef_server_test.rb @@ -54,8 +54,9 @@ class ChefServerProvisionerTest < Test::Unit::TestCase end @action.stubs(:env).returns(@env) + @action.stubs(:validation_key_path).returns("9") - File.expects(:file?).with(@env.config.chef.validation_key_path).returns(true) + File.expects(:file?).with(@action.validation_key_path).returns(true) assert_nothing_raised { @action.prepare } end @@ -65,8 +66,9 @@ class ChefServerProvisionerTest < Test::Unit::TestCase end @action.stubs(:env).returns(@env) + @action.stubs(:validation_key_path).returns("9") - File.expects(:file?).with(@env.config.chef.validation_key_path).returns(false) + File.expects(:file?).with(@action.validation_key_path).returns(false) assert_raises(Vagrant::Actions::ActionException) { @action.prepare }