From 617cf630b1f31b10219087773b2131215fb6cc2f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 12 Apr 2014 16:14:58 -0700 Subject: [PATCH] commands/rdp: error if RDP info can't be detected --- plugins/commands/rdp/command.rb | 9 ++++++--- plugins/commands/rdp/errors.rb | 4 ++++ templates/locales/command_rdp.yml | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/commands/rdp/command.rb b/plugins/commands/rdp/command.rb index c06872134..bcdde61bf 100644 --- a/plugins/commands/rdp/command.rb +++ b/plugins/commands/rdp/command.rb @@ -30,9 +30,12 @@ module VagrantPlugins name: machine.guest.name.to_s end - @env.host.capability( - :rdp_client, - machine.guest.capability(:rdp_info)) + rdp_info = machine.guest.capability(:rdp_info) + if !rdp_info + raise Errors::RDPUndetected + end + + @env.host.capability(:rdp_client, rdp_info) end end end diff --git a/plugins/commands/rdp/errors.rb b/plugins/commands/rdp/errors.rb index 5bc4fea33..873441fb0 100644 --- a/plugins/commands/rdp/errors.rb +++ b/plugins/commands/rdp/errors.rb @@ -13,6 +13,10 @@ module VagrantPlugins class HostUnsupported < RDPError error_key(:host_unsupported) end + + class RDPUndetected < RDPError + error_key(:rdp_undetected) + end end end end diff --git a/templates/locales/command_rdp.yml b/templates/locales/command_rdp.yml index aeabd699e..3bc94b52d 100644 --- a/templates/locales/command_rdp.yml +++ b/templates/locales/command_rdp.yml @@ -19,3 +19,8 @@ en: an RDP client, please contribute this functionality back into Vagrant. At the very least, open an issue on how it could be done and we can handle the integration. + rdp_undetected: |- + RDP connection information for this machine could not be + detected. This is typically caused when we can't find the IP + or port to connect to for RDP. Please verify you're forwarding + an RDP port and that your machine is accessible.