core: SSHExec middleware can have ssh info overridden

This commit is contained in:
Mitchell Hashimoto 2014-04-15 19:54:02 -07:00
parent 6721d8e964
commit aa1abdd1c4
2 changed files with 13 additions and 2 deletions

View File

@ -21,8 +21,9 @@ module Vagrant
end end
def call(env) def call(env)
# Grab the SSH info from the machine # Grab the SSH info from the machine or the environment
info = env[:machine].ssh_info info = env[:ssh_info]
info ||= env[:machine].ssh_info
# If the result is nil, then the machine is telling us that it is # If the result is nil, then the machine is telling us that it is
# not yet ready for SSH, so we raise this exception. # not yet ready for SSH, so we raise this exception.

View File

@ -46,6 +46,16 @@ describe Vagrant::Action::Builtin::SSHExec do
described_class.new(app, env).call(env) described_class.new(app, env).call(env)
end end
it "should exec with the SSH info in the env if given" do
ssh_info = { foo: :bar }
expect(ssh_klass).to receive(:exec).
with(ssh_info, nil)
env[:ssh_info] = ssh_info
described_class.new(app, env).call(env)
end
it "should exec with the options given in `ssh_opts`" do it "should exec with the options given in `ssh_opts`" do
ssh_opts = { :foo => :bar } ssh_opts = { :foo => :bar }