From 5bbb84efa70489caa800d4ec59bfc999359ff064 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 20 Mar 2010 01:25:14 -0700 Subject: [PATCH] Chef server validation key path now expands --- lib/vagrant/provisioners/chef_server.rb | 2 +- test/vagrant/provisioners/chef_server_test.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 }