Pass a proper Pathname for SSHExec to check key perms

This commit is contained in:
Mitchell Hashimoto 2013-02-04 21:17:12 -08:00
parent 434cc79a83
commit 864f1b7506
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,5 @@
require "pathname"
require "vagrant/util/ssh"
module Vagrant
@ -26,8 +28,10 @@ module Vagrant
# not yet ready for SSH, so we raise this exception.
raise Errors::SSHNotReady if info.nil?
# Check the SSH key permissions
SSH.check_key_permissions(info[:private_key_path])
if info[:private_key_path]
# Check the SSH key permissions
SSH.check_key_permissions(Pathname.new(info[:private_key_path]))
end
# Exec!
SSH.exec(info, env[:ssh_opts])

View File

@ -30,8 +30,10 @@ describe Vagrant::Action::Builtin::SSHExec do
end
it "should check key permissions then exec" do
machine_ssh_info[:private_key_path] = "/foo"
ssh_klass.should_receive(:check_key_permissions).
with(machine_ssh_info[:private_key_path]).
with(Pathname.new(machine_ssh_info[:private_key_path])).
once.
ordered