Chef server validation key path now expands

This commit is contained in:
Mitchell Hashimoto 2010-03-20 01:25:14 -07:00
parent 1d518e2693
commit 5bbb84efa7
2 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ module Vagrant
def prepare def prepare
if env.config.chef.validation_key_path.nil? if env.config.chef.validation_key_path.nil?
raise Actions::ActionException.new(:chef_server_validation_key_required) 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) raise Actions::ActionException.new(:chef_server_validation_key_doesnt_exist)
end end

View File

@ -54,8 +54,9 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
end end
@action.stubs(:env).returns(@env) @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 } assert_nothing_raised { @action.prepare }
end end
@ -65,8 +66,9 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
end end
@action.stubs(:env).returns(@env) @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) { assert_raises(Vagrant::Actions::ActionException) {
@action.prepare @action.prepare
} }