kernel/v2: automatically forward winrm if comm is winrm [GH-3685]
This commit is contained in:
parent
1eec62cb9e
commit
434a13b4e4
|
@ -2,6 +2,8 @@
|
|||
|
||||
IMPROVEMENTS:
|
||||
|
||||
- core: Automatically forward WinRM port if communicator is
|
||||
WinRM. [GH-3685]
|
||||
- command/rdp: Args after "--" are passed directly through to the
|
||||
RDP client. [GH-3686]
|
||||
- providers/docker: `build_args` config to specify extra args for
|
||||
|
|
|
@ -358,7 +358,16 @@ module VagrantPlugins
|
|||
define(DEFAULT_VM_NAME) if defined_vm_keys.empty?
|
||||
|
||||
# Make sure the SSH forwarding is added if it doesn't exist
|
||||
if !@__networks["forwarded_port-ssh"]
|
||||
if @communicator == :winrm
|
||||
if !@__networks["forwarded_port-winrm"]
|
||||
network :forwarded_port,
|
||||
guest: 5985,
|
||||
host: 55985,
|
||||
host_ip: "127.0.0.1",
|
||||
id: "winrm",
|
||||
auto_correct: true
|
||||
end
|
||||
elsif !@__networks["forwarded_port-ssh"]
|
||||
network :forwarded_port,
|
||||
guest: 22,
|
||||
host: 2222,
|
||||
|
|
|
@ -145,7 +145,7 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
|
|||
end
|
||||
|
||||
describe "#network(s)" do
|
||||
it "defaults to forwarding SSH" do
|
||||
it "defaults to forwarding SSH by default" do
|
||||
subject.finalize!
|
||||
n = subject.networks
|
||||
expect(n.length).to eq(1)
|
||||
|
@ -156,6 +156,18 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
|
|||
expect(n[0][1][:id]).to eq("ssh")
|
||||
end
|
||||
|
||||
it "defaults to forwarding WinRM if communicator is winrm" do
|
||||
subject.communicator = "winrm"
|
||||
subject.finalize!
|
||||
n = subject.networks
|
||||
expect(n.length).to eq(1)
|
||||
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")
|
||||
end
|
||||
|
||||
it "allows overriding SSH" do
|
||||
subject.network "forwarded_port",
|
||||
guest: 22, host: 14100, id: "ssh"
|
||||
|
@ -169,6 +181,20 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
|
|||
expect(n[0][1][:id]).to eq("ssh")
|
||||
end
|
||||
|
||||
it "allows overriding WinRM" do
|
||||
subject.communicator = :winrm
|
||||
subject.network "forwarded_port",
|
||||
guest: 22, host: 14100, id: "winrm"
|
||||
subject.finalize!
|
||||
|
||||
n = subject.networks
|
||||
expect(n.length).to eq(1)
|
||||
expect(n[0][0]).to eq(:forwarded_port)
|
||||
expect(n[0][1][:guest]).to eq(22)
|
||||
expect(n[0][1][:host]).to eq(14100)
|
||||
expect(n[0][1][:id]).to eq("winrm")
|
||||
end
|
||||
|
||||
it "turns all forwarded port ports to ints" do
|
||||
subject.network "forwarded_port",
|
||||
guest: "45", host: "4545", id: "test"
|
||||
|
|
Loading…
Reference in New Issue