core: SSHExec middleware can have ssh info overridden
This commit is contained in:
parent
6721d8e964
commit
aa1abdd1c4
|
@ -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.
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue