fix pscommand error messaging

This commit is contained in:
Matt Wrock 2015-06-05 22:24:05 -07:00
parent 740877065a
commit e6daf2f172
3 changed files with 21 additions and 6 deletions

View File

@ -91,7 +91,7 @@ module VagrantPlugins
args << "-password" << ps_info[:password]
result = Vagrant::Util::PowerShell.execute(script_path, *args)
if result.exit_code != 0
raise Errors::PowershellError,
raise Errors::PowerShellError,
script: script_path,
stderr: result.stderr
end
@ -108,7 +108,7 @@ module VagrantPlugins
args << "-hostname" << ps_info[:host]
result = Vagrant::Util::PowerShell.execute(script_path, *args)
if result.exit_code != 0
raise Errors::PowershellError,
raise Errors::PowerShellError,
script: script_path,
stderr: result.stderr
end

View File

@ -2,17 +2,21 @@ module VagrantPlugins
module CommandPS
module Errors
# A convenient superclass for all our errors.
class PSError < Vagrant::Errors::VagrantError
class PSCommandError < Vagrant::Errors::VagrantError
error_namespace("vagrant_ps.errors")
end
class HostUnsupported < PSError
class HostUnsupported < PSCommandError
error_key(:host_unsupported)
end
class PSRemotingUndetected < PSError
class PSRemotingUndetected < PSCommandError
error_key(:ps_remoting_undetected)
end
class PowerShellError < PSCommandError
error_key(:powershell_error)
end
end
end
end

View File

@ -3,7 +3,7 @@ en:
detecting: |-
Detecting if a remote PowerShell connection can be made with the guest...
reseting: |-
Reseting WinRM TrustedHosts to their original value.
Resetting WinRM TrustedHosts to their original value.
errors:
host_unsupported: |-
@ -14,3 +14,14 @@ en:
Unable to establish a remote PowerShell connection with the guest.
Check if the firewall rules on the guest allow connections to the
Windows remote management service.
powershell_error: |-
An error occurred while executing a PowerShell script. This error
is shown below. Please read the error message and see if this is
a configuration error with your system. If it is not, then please
report a bug.
Script: %{script}
Error:
%{stderr}