hosts/darwin: rdp client support by subprocessing `open`
This commit is contained in:
parent
ce08a37d5f
commit
b0b445fcac
|
@ -2,10 +2,10 @@ require "vagrant"
|
|||
|
||||
module VagrantPlugins
|
||||
module HostBSD
|
||||
# Represents a BSD host, such as FreeBSD and Darwin (Mac OS X).
|
||||
# Represents a BSD host, such as FreeBSD.
|
||||
class Host < Vagrant.plugin("2", :host)
|
||||
def detect?(env)
|
||||
Vagrant::Util::Platform.darwin? || Vagrant::Util::Platform.bsd?
|
||||
Vagrant::Util::Platform.darwin?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
require "tempfile"
|
||||
|
||||
require "vagrant/util/subprocess"
|
||||
|
||||
module VagrantPlugins
|
||||
module HostDarwin
|
||||
module Cap
|
||||
class RDP
|
||||
def self.rdp_client(env, rdp_info)
|
||||
config = nil
|
||||
opts = {
|
||||
"drivestoredirect:s" => "*",
|
||||
"full address:s" => "#{rdp_info[:host]}:#{rdp_info[:port]}",
|
||||
"prompt for credentials:i" => "1",
|
||||
"username:s" => rdp_info[:username],
|
||||
}
|
||||
|
||||
# Create the ".rdp" file
|
||||
config = Tempfile.new(["vagrant-rdp", ".rdp"])
|
||||
opts.each do |k, v|
|
||||
config.puts("#{k}:#{v}")
|
||||
end
|
||||
config.close
|
||||
|
||||
# Launch it
|
||||
Vagrant::Util::Subprocess.execute("open", config.path)
|
||||
ensure
|
||||
config.close if config
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
require "vagrant/util/platform"
|
||||
|
||||
module VagrantPlugins
|
||||
module HostDarwin
|
||||
class Host < Vagrant.plugin("2", :host)
|
||||
def detect?(env)
|
||||
Vagrant::Util::Platform.darwin?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
require "vagrant"
|
||||
|
||||
module VagrantPlugins
|
||||
module HostDarwin
|
||||
class Plugin < Vagrant.plugin("2")
|
||||
name "Mac OS X host"
|
||||
description "Mac OS X host support."
|
||||
|
||||
host("darwin", "bsd") do
|
||||
require_relative "host"
|
||||
Host
|
||||
end
|
||||
|
||||
host_capability("darwin", "rdp_client") do
|
||||
require_relative "cap/rdp"
|
||||
Cap::RDP
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue