provisioners/ansible: review pull request #7752
- Honour `ssh.proxy_command` setting (even when the Docker provider is used via a proxy host). Silly configurations may lead to silly behaviors, but let's apply the settings... - Remove condition on `provider_config.connect_via_ssh`, which is a provider specific parameter (from vagrant-libvirt provider). - Add a simple unit test
This commit is contained in:
parent
a1d78edaf8
commit
e8cf9bb168
|
@ -234,7 +234,10 @@ module VagrantPlugins
|
|||
proxy_cmd += " exec nc %h %p 2>/dev/null"
|
||||
|
||||
ssh_options << "-o ProxyCommand='#{ proxy_cmd }'"
|
||||
elsif @machine.ssh_info[:proxy_command] && @machine.provider_config.connect_via_ssh
|
||||
end
|
||||
|
||||
# Use an SSH ProxyCommand when corresponding Vagrant setting is defined
|
||||
if @machine.ssh_info[:proxy_command]
|
||||
proxy_cmd = @machine.ssh_info[:proxy_command]
|
||||
ssh_options << "-o ProxyCommand='#{ proxy_cmd }'"
|
||||
end
|
||||
|
|
|
@ -665,6 +665,19 @@ VF
|
|||
end
|
||||
end
|
||||
|
||||
describe "with an ssh proxy command configured" do
|
||||
before do
|
||||
ssh_info[:proxy_command] = "ssh -W %h:%p -q user@remote_libvirt_host"
|
||||
end
|
||||
|
||||
it "sets '-o ProxyCommand' via ANSIBLE_SSH_ARGS" do
|
||||
expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args|
|
||||
cmd_opts = args.last
|
||||
expect(cmd_opts[:env]['ANSIBLE_SSH_ARGS']).to include("-o ProxyCommand='ssh -W %h:%p -q user@remote_libvirt_host'")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context "with verbose option defined" do
|
||||
%w(vv vvvv).each do |verbose_option|
|
||||
|
||||
|
|
Loading…
Reference in New Issue