[PATCH aeolus-conductor] BZ#796247 Update Credentials Check to use new DC Client Errors
mtaylor at redhat.com
mtaylor at redhat.com
Thu Feb 23 16:41:57 UTC 2012
From: Martyn Taylor <mtaylor at redhat.com>
---
src/app/models/provider_account.rb | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index eff59f9..e53b4c6 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -87,10 +87,12 @@ class ProviderAccount < ActiveRecord::Base
def validate_credentials
begin
- unless valid_credentials?
- errors.add(:base, I18N.t('provider_accounts.errors.invalid_credentials'))
- end
- rescue
+ valid_credentials?
+ rescue DeltaCloud::HTTPError::Unauthorized => ue
+ logger.debug("Unauthorized Error Rasied by Deltacloud: #{ue.inspect}")
+ errors.add(:base, I18n.t('provider_accounts.errors.invalid_credentials'))
+ rescue => e
+ logger.error("Error validating credentials: #{e.inspect}")
errors.add(:base, I18n.t('provider_accounts.errors.exception_while_validating'))
end
end
--
1.7.6.4
More information about the aeolus-devel
mailing list