[PATCH aeolus-conductor] BZ#796247 Update Credentials Check to use new DC Client Errors
Matt Wagner
matt.wagner at redhat.com
Wed Feb 29 16:31:54 UTC 2012
On Thu, Feb 23, 2012 at 10:57:29AM +0000, mtaylor at redhat.com wrote:
> 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}")
^^^^^^
Oh, one nit -- that should be "Raised".
> + 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