Skip to content

Commit

Permalink
Merge pull request #43 from gasper-vrhovsek/feature/security_protocol…
Browse files Browse the repository at this point in the history
…_pretty_error

Human readable error when selecting wrong security protocol
(cherry picked from commit 8ac64a6)
  • Loading branch information
Bronagh Sorota authored and simaishi committed Dec 19, 2017
1 parent 935da22 commit 110b7a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/manageiq/providers/nuage/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def translate_exception(err)
MiqException::MiqHostError.new("Socket error: #{err.message}")
when MiqException::MiqInvalidCredentialsError, MiqException::MiqHostError
err
when Net::HTTPBadResponse
MiqException::MiqEVMLoginError.new("Login failed due to a bad security protocol, hostname or port.")
else
MiqException::MiqEVMLoginError.new("Unexpected response returned from system: #{err.message}")
end
Expand Down
6 changes: 6 additions & 0 deletions spec/models/manageiq/providers/nuage/network_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
allow(@ems).to receive(:with_provider_connection).and_raise(exception)
expect { @ems.verify_credentials }.to raise_error(MiqException::MiqHostError, /invalid host/)
end

it 'handles Net::HTTPBadResponse' do
exception = Net::HTTPBadResponse.new
allow(@ems).to receive(:with_provider_connection).and_raise(exception)
expect { @ems.verify_credentials }.to raise_error(MiqException::MiqEVMLoginError, /Login failed due to a bad security protocol, hostname or port./)
end
end

context '#authentications_to_validate' do
Expand Down

0 comments on commit 110b7a7

Please sign in to comment.