commands/rdp: rdp_info cap if avail [GH-3832]
This commit is contained in:
parent
d7fa60b5df
commit
4dbe534c02
|
@ -48,7 +48,7 @@ BUG FIXES:
|
||||||
|
|
||||||
PLUGIN AUTHOR CHANGES:
|
PLUGIN AUTHOR CHANGES:
|
||||||
|
|
||||||
- Providers can now implement the `winrm_info` provider capability
|
- Providers can now implement the `rdp_info` provider capability
|
||||||
to get proper info for `vagrant rdp` to function.
|
to get proper info for `vagrant rdp` to function.
|
||||||
|
|
||||||
## 1.6.2 (May 12, 2014)
|
## 1.6.2 (May 12, 2014)
|
||||||
|
|
|
@ -54,16 +54,25 @@ module VagrantPlugins
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def get_rdp_info(machine)
|
def get_rdp_info(machine)
|
||||||
ssh_info = machine.ssh_info
|
rdp_info = {}
|
||||||
username = ssh_info[:username]
|
if machine.provider.capability?(:rdp_info)
|
||||||
if machine.config.vm.communicator == :winrm
|
rdp_info = machine.provider.capability(:rdp_info)
|
||||||
username = machine.config.winrm.username
|
|
||||||
end
|
end
|
||||||
|
|
||||||
host = ssh_info[:host]
|
ssh_info = machine.ssh_info
|
||||||
port = machine.config.rdp.port
|
|
||||||
|
|
||||||
if host == "127.0.0.1"
|
if !rdp_info[:username]
|
||||||
|
username = ssh_info[:username]
|
||||||
|
if machine.config.vm.communicator == :winrm
|
||||||
|
username = machine.config.winrm.username
|
||||||
|
end
|
||||||
|
rdp_info[:username] = username
|
||||||
|
end
|
||||||
|
|
||||||
|
rdp_info[:host] ||= ssh_info[:host]
|
||||||
|
rdp_info[:port] ||= machine.config.rdp.port
|
||||||
|
|
||||||
|
if rdp_info[:host] == "127.0.0.1"
|
||||||
# We need to find a forwarded port...
|
# We need to find a forwarded port...
|
||||||
search_port = machine.config.rdp.search_port
|
search_port = machine.config.rdp.search_port
|
||||||
ports = nil
|
ports = nil
|
||||||
|
@ -81,14 +90,11 @@ module VagrantPlugins
|
||||||
|
|
||||||
ports = ports.invert
|
ports = ports.invert
|
||||||
port = ports[search_port]
|
port = ports[search_port]
|
||||||
|
rdp_info[:port] = port
|
||||||
return nil if !port
|
return nil if !port
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return rdp_info
|
||||||
host: host,
|
|
||||||
port: port,
|
|
||||||
username: username,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue