Skip to content

Commit

Permalink
Add RDPPort to vagrant winrm-config.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnichol committed Mar 26, 2015
1 parent 473d0cb commit d672a4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/vagrant-winrm/commands/winrm_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def execute
winrm_host: VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(machine)[:host],
winrm_port: VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(machine)[:port],
winrm_user: machine.config.winrm.username,
winrm_password: machine.config.winrm.password
winrm_password: machine.config.winrm.password,
rdp_port: machine.config.rdp.port
}

# Render the template and output directly to STDOUT
Expand Down
7 changes: 6 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ def mock_env
allow(config).to receive(:[]) { |key| config.send(key) }
end
}
let(:rdp_config) {
double('rdp_config', port: 4321, search_port: 98765).tap do |config|
allow(config).to receive(:[]) { |key| config.send(key) }
end
}
let(:config_vm) { double('config_vm', communicator: :winrm) }
let(:machine_config) { double('machine_config', winrm: winrm_config, vm: config_vm) }
let(:machine_config) { double('machine_config', winrm: winrm_config, rdp: rdp_config, vm: config_vm) }

let(:provider) {
double('provider', to_sym: :virtualbox).tap do |provider|
Expand Down
3 changes: 3 additions & 0 deletions spec/vagrant-winrm/commands/winrm_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
expect($stdout.string).to match(/#{winrm_config.port}/)
expect($stdout.string).to match(/#{winrm_config.username}/)
expect($stdout.string).to match(/#{winrm_config.password}/)
expect($stdout.string).to match(/#{rdp_config.port}/)
ensure
$stdout = STDOUT
end
Expand All @@ -74,6 +75,7 @@
expect($stdout.string).to match(/#{winrm_config.port}/)
expect($stdout.string).to match(/#{winrm_config.username}/)
expect($stdout.string).to match(/#{winrm_config.password}/)
expect($stdout.string).to match(/#{rdp_config.port}/)
ensure
$stdout = STDOUT
end
Expand All @@ -89,6 +91,7 @@
expect($stdout.string).to match(/#{winrm_config.port}/)
expect($stdout.string).to match(/#{winrm_config.username}/)
expect($stdout.string).to match(/#{winrm_config.password}/)
expect($stdout.string).to match(/#{rdp_config.port}/)
ensure
$stdout = STDOUT
end
Expand Down
3 changes: 2 additions & 1 deletion templates/winrm_config/config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ Host <%= host_key %>
HostName <%= winrm_host %>
Port <%= winrm_port %>
User <%= winrm_user %>
Password <%= winrm_password %>
Password <%= winrm_password %>
RDPPort <%= rdp_port %>

0 comments on commit d672a4e

Please sign in to comment.