Change authorization error tests to match WinRM 1.3
This commit is contained in:
parent
c37c12526a
commit
5d5e13bc0f
|
@ -22,6 +22,7 @@ module VagrantPlugins
|
||||||
@@exceptions_to_retry_on = [
|
@@exceptions_to_retry_on = [
|
||||||
HTTPClient::KeepAliveDisconnected,
|
HTTPClient::KeepAliveDisconnected,
|
||||||
WinRM::WinRMHTTPTransportError,
|
WinRM::WinRMHTTPTransportError,
|
||||||
|
WinRM::WinRMAuthorizationError,
|
||||||
Errno::EACCES,
|
Errno::EACCES,
|
||||||
Errno::EADDRINUSE,
|
Errno::EADDRINUSE,
|
||||||
Errno::ECONNREFUSED,
|
Errno::ECONNREFUSED,
|
||||||
|
@ -124,15 +125,6 @@ module VagrantPlugins
|
||||||
message: exception.message
|
message: exception.message
|
||||||
when WinRM::WinRMHTTPTransportError
|
when WinRM::WinRMHTTPTransportError
|
||||||
case exception.status_code
|
case exception.status_code
|
||||||
# If the error is a 401, we can return a more specific error message
|
|
||||||
when 401
|
|
||||||
raise Errors::AuthenticationFailed,
|
|
||||||
user: @config.username,
|
|
||||||
password: @config.password,
|
|
||||||
endpoint: endpoint,
|
|
||||||
message: exception.message
|
|
||||||
end
|
|
||||||
|
|
||||||
raise Errors::ExecutionError,
|
raise Errors::ExecutionError,
|
||||||
shell: shell,
|
shell: shell,
|
||||||
command: command,
|
command: command,
|
||||||
|
|
|
@ -31,7 +31,7 @@ describe VagrantPlugins::CommunicatorWinRM::WinRMShell do
|
||||||
it "should raise auth error when WinRM exception has a response code of 401" do
|
it "should raise auth error when WinRM exception has a response code of 401" do
|
||||||
# The default settings might an account lockout - 20 auth failures!
|
# The default settings might an account lockout - 20 auth failures!
|
||||||
expect(session).to receive(:powershell).with(/^dir.+/).exactly(20).times.and_raise(
|
expect(session).to receive(:powershell).with(/^dir.+/).exactly(20).times.and_raise(
|
||||||
WinRM::WinRMHTTPTransportError.new("Oh no!!", 401))
|
WinRM::WinRMAuthorizationError.new("Oh no!!", 401))
|
||||||
expect { subject.powershell("dir") }.to raise_error(
|
expect { subject.powershell("dir") }.to raise_error(
|
||||||
VagrantPlugins::CommunicatorWinRM::Errors::AuthenticationFailed)
|
VagrantPlugins::CommunicatorWinRM::Errors::AuthenticationFailed)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue