You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/02/01 14:55:20 UTC

[PATCH core 2/3] Core: Return 404 instead of exception when accessing non-existing driver in drivers collection

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/server.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb
index 9801d60..57b7daa 100644
--- a/server/lib/deltacloud/server.rb
+++ b/server/lib/deltacloud/server.rb
@@ -167,7 +167,7 @@ EOS
         @providers = driver.providers(credentials)  if driver.respond_to? :providers
       end
       @driver = settings.drivers[@name]
-      return [404, "Driver #{@name} not found"] unless @driver
+      halt 404 unless @driver
       respond_to do |format|
         format.xml { haml :"drivers/show" }
         format.json { @driver.to_json }
-- 
1.7.4.4


Re: [PATCH core 2/3] Core: Return 404 instead of exception when accessing non-existing driver in drivers collection

Posted by Francesco Vollero <fv...@redhat.com>.
Ack'd tested and work smoothly 

On Wed, Feb 01, 2012 at 02:55:20PM +0100, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/lib/deltacloud/server.rb |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb
> index 9801d60..57b7daa 100644
> --- a/server/lib/deltacloud/server.rb
> +++ b/server/lib/deltacloud/server.rb
> @@ -167,7 +167,7 @@ EOS
>          @providers = driver.providers(credentials)  if driver.respond_to? :providers
>        end
>        @driver = settings.drivers[@name]
> -      return [404, "Driver #{@name} not found"] unless @driver
> +      halt 404 unless @driver
>        respond_to do |format|
>          format.xml { haml :"drivers/show" }
>          format.json { @driver.to_json }
> -- 
> 1.7.4.4
>