Fix RDP connections on OS X

Changes introduced in 982af05 caused the RDP configuration file to be written
with all settings on one line instead of one setting per line. The Microsoft
Remote Desktop client for OS X rejects these configuration files as being
malformed. This patch restores the configuration to one line per setting and
adds tests to guard against regression.
This commit is contained in:
Charlie Sharpsteen 2016-08-09 13:58:47 -07:00
parent 5eb5f66a31
commit 4144b45122
2 changed files with 9 additions and 9 deletions

View File

@ -40,12 +40,12 @@ module VagrantPlugins
f.binmode f.binmode
opts.each do |k, v| opts.each do |k, v|
f.write("#{k}:#{v}") f.puts("#{k}:#{v}")
end end
if rdp_info[:extra_args] if rdp_info[:extra_args]
rdp_info[:extra_args].each do |arg| rdp_info[:extra_args].each do |arg|
f.write("#{arg}") f.puts("#{arg}")
end end
end end

View File

@ -13,18 +13,18 @@ describe VagrantPlugins::HostDarwin::Cap::RDP do
it "includes the default options" do it "includes the default options" do
path = described_class.generate_config_file(rdp_info) path = described_class.generate_config_file(rdp_info)
result = File.read(path) result = File.readlines(path).map(&:chomp)
expect(result).to match("drivestoredirect:s:*") expect(result).to include("drivestoredirect:s:*")
expect(result).to match("full address:s:host:port") expect(result).to include("full address:s:host:port")
expect(result).to match("prompt for credentials:i:1") expect(result).to include("prompt for credentials:i:1")
expect(result).to match("username:s:username") expect(result).to include("username:s:username")
end end
it "includes extra RDP arguments" do it "includes extra RDP arguments" do
rdp_info.merge!(extra_args: ["screen mode id:i:0"]) rdp_info.merge!(extra_args: ["screen mode id:i:0"])
path = described_class.generate_config_file(rdp_info) path = described_class.generate_config_file(rdp_info)
result = File.read(path) result = File.readlines(path).map(&:chomp)
expect(result).to match("screen mode id:i:0") expect(result).to include("screen mode id:i:0")
end end
it "opens the RDP file" do it "opens the RDP file" do