core: SSHExec middleware can have ssh info overridden
This commit is contained in:
parent
6721d8e964
commit
aa1abdd1c4
|
@ -21,8 +21,9 @@ module Vagrant
|
|||
end
|
||||
|
||||
def call(env)
|
||||
# Grab the SSH info from the machine
|
||||
info = env[:machine].ssh_info
|
||||
# Grab the SSH info from the machine or the environment
|
||||
info = env[:ssh_info]
|
||||
info ||= env[:machine].ssh_info
|
||||
|
||||
# If the result is nil, then the machine is telling us that it is
|
||||
# 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)
|
||||
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
|
||||
ssh_opts = { :foo => :bar }
|
||||
|
||||
|
|
Loading…
Reference in New Issue