incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH] Put the credentials check for mock in a safely block.
Date Wed, 08 Jun 2011 09:38:00 GMT
On Jun 7, 2011, at 10:39 PM, Chris Lalancette wrote:

> Otherwise, the "raise 'AuthFailure'" piece of code won't
> display the correct error view.

ACK. Nice catch!

  -- Michal

> 
> Signed-off-by: Chris Lalancette <clalance@redhat.com>
> ---
> server/lib/deltacloud/drivers/mock/mock_driver.rb |    6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
> index b1506fa..9697e5b 100644
> --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
> +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
> @@ -499,8 +499,10 @@ class MockDriver < Deltacloud::BaseDriver
>   private
> 
>   def check_credentials(credentials)
> -    if ( credentials.user != 'mockuser' ) or ( credentials.password != 'mockpassword'
)
> -      raise 'AuthFailure'
> +    safely do
> +      if ( credentials.user != 'mockuser' ) or ( credentials.password != 'mockpassword'
)
> +        raise 'AuthFailure'
> +      end
>     end
>   end
> 
> -- 
> 1.7.4.4
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Mime
View raw message