Pass a proper Pathname for SSHExec to check key perms
This commit is contained in:
parent
434cc79a83
commit
864f1b7506
|
@ -1,3 +1,5 @@
|
||||||
|
require "pathname"
|
||||||
|
|
||||||
require "vagrant/util/ssh"
|
require "vagrant/util/ssh"
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -26,8 +28,10 @@ module Vagrant
|
||||||
# not yet ready for SSH, so we raise this exception.
|
# not yet ready for SSH, so we raise this exception.
|
||||||
raise Errors::SSHNotReady if info.nil?
|
raise Errors::SSHNotReady if info.nil?
|
||||||
|
|
||||||
# Check the SSH key permissions
|
if info[:private_key_path]
|
||||||
SSH.check_key_permissions(info[:private_key_path])
|
# Check the SSH key permissions
|
||||||
|
SSH.check_key_permissions(Pathname.new(info[:private_key_path]))
|
||||||
|
end
|
||||||
|
|
||||||
# Exec!
|
# Exec!
|
||||||
SSH.exec(info, env[:ssh_opts])
|
SSH.exec(info, env[:ssh_opts])
|
||||||
|
|
|
@ -30,8 +30,10 @@ describe Vagrant::Action::Builtin::SSHExec do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should check key permissions then exec" do
|
it "should check key permissions then exec" do
|
||||||
|
machine_ssh_info[:private_key_path] = "/foo"
|
||||||
|
|
||||||
ssh_klass.should_receive(:check_key_permissions).
|
ssh_klass.should_receive(:check_key_permissions).
|
||||||
with(machine_ssh_info[:private_key_path]).
|
with(Pathname.new(machine_ssh_info[:private_key_path])).
|
||||||
once.
|
once.
|
||||||
ordered
|
ordered
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue