diff --git a/plugins/commands/rdp/command.rb b/plugins/commands/rdp/command.rb index 0ee15cc33..766514bcb 100644 --- a/plugins/commands/rdp/command.rb +++ b/plugins/commands/rdp/command.rb @@ -48,11 +48,11 @@ module VagrantPlugins end host = ssh_info[:host] - port = 3389 + port = machine.config.rdp.port if host == "127.0.0.1" # We need to find a forwarded port... - search_port = 3389 + search_port = machine.config.rdp.search_port ports = nil if machine.provider.capability?(:forwarded_ports) ports = machine.provider.capability(:forwarded_ports) diff --git a/plugins/commands/rdp/config.rb b/plugins/commands/rdp/config.rb new file mode 100644 index 000000000..1384c6713 --- /dev/null +++ b/plugins/commands/rdp/config.rb @@ -0,0 +1,23 @@ +module VagrantPlugins + module CommandRDP + class Config < Vagrant.plugin("2", :config) + attr_accessor :port + attr_accessor :search_port + + def initialize + @port = UNSET_VALUE + @search_port = UNSET_VALUE + end + + def finalize! + @port = 3389 if @port == UNSET_VALUE + @search_port = 3389 if @search_port == UNSET_VALUE + end + + def validate(machine) + errors = _detected_errors + { "RDP" => errors } + end + end + end +end diff --git a/plugins/commands/rdp/plugin.rb b/plugins/commands/rdp/plugin.rb index 5cc00be78..83e1a023f 100644 --- a/plugins/commands/rdp/plugin.rb +++ b/plugins/commands/rdp/plugin.rb @@ -17,6 +17,11 @@ module VagrantPlugins Command end + config("rdp") do + require_relative "config" + Config + end + protected def self.init!