Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move validation code to VimConnectMixin #104

Merged
merged 1 commit into from
Sep 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,9 @@ def stop_control_monitor
end

def verify_credentials(auth_type = nil, _options = {})
raise "no credentials defined" if self.missing_credentials?(auth_type)

begin
self.class.validate_connection do
with_provider_connection(:use_broker => false, :auth_type => auth_type) {}
rescue SocketError, Errno::EHOSTUNREACH, Errno::ENETUNREACH
_log.warn($!.inspect)
raise MiqException::MiqUnreachableError, $!.message
rescue Handsoap::Fault
_log.warn($!.inspect)
if $!.respond_to?(:reason)
raise MiqException::MiqInvalidCredentialsError, $!.reason if $!.reason =~ /Authorize Exception|incorrect user name or password/
raise $!.reason
end
raise $!.message
rescue Exception
_log.warn($!.inspect)
raise "Unexpected response returned from #{ui_lookup(:table => "ext_management_systems")}, see log for details"
end

true
end

def reset_vim_cache
Expand Down