Merge pull request #7287 from KierranM/win-ssh-forward

[#7202] Always forward SSH on Windows
This commit is contained in:
Seth Vargo 2016-05-29 00:58:18 -04:00
commit 61adbf77d4
2 changed files with 30 additions and 2 deletions

View File

@ -425,7 +425,9 @@ module VagrantPlugins
id: "winrm-ssl",
auto_correct: true
end
elsif !@__networks["forwarded_port-ssh"]
end
# forward SSH ports regardless of communicator
if !@__networks["forwarded_port-ssh"]
network :forwarded_port,
guest: 22,
host: 2222,

View File

@ -173,7 +173,7 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
subject.communicator = "winrm"
subject.finalize!
n = subject.networks
expect(n.length).to eq(2)
expect(n.length).to eq(3)
expect(n[0][0]).to eq(:forwarded_port)
expect(n[0][1][:guest]).to eq(5985)
@ -188,6 +188,32 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
expect(n[1][1][:id]).to eq("winrm-ssl")
end
it "forwards ssh even if the communicator is winrm" do
subject.communicator = "winrm"
subject.finalize!
n = subject.networks
expect(n.length).to eq(3)
expect(n[0][0]).to eq(:forwarded_port)
expect(n[0][1][:guest]).to eq(5985)
expect(n[0][1][:host]).to eq(55985)
expect(n[0][1][:host_ip]).to eq("127.0.0.1")
expect(n[0][1][:id]).to eq("winrm")
expect(n[1][0]).to eq(:forwarded_port)
expect(n[1][1][:guest]).to eq(5986)
expect(n[1][1][:host]).to eq(55986)
expect(n[1][1][:host_ip]).to eq("127.0.0.1")
expect(n[1][1][:id]).to eq("winrm-ssl")
expect(n[2][0]).to eq(:forwarded_port)
expect(n[2][1][:guest]).to eq(22)
expect(n[2][1][:host]).to eq(2222)
expect(n[2][1][:host_ip]).to eq("127.0.0.1")
expect(n[2][1][:id]).to eq("ssh")
end
it "allows overriding SSH" do
subject.network "forwarded_port",
guest: 22, host: 14100, id: "ssh"