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 2011/11/23 17:23:23 UTC

[PATCH core 3/5] Core: Make 'features' optional for driver

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


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

diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
index 5c63fd9..21f0645 100644
--- a/server/lib/sinatra/rabbit.rb
+++ b/server/lib/sinatra/rabbit.rb
@@ -168,9 +168,9 @@ module Sinatra
       # operation plus the params defined by any features in the +driver+
       # that might modify this operation
       def effective_params(driver)
-        driver.features(@collection.name).collect do |f|
+        (driver.respond_to?(:features) ? driver.features(@collection.name).collect do |f|
           f.decl.operation(@name)
-        end.flatten.select { |op| op }.inject(params.dup) do |result, fop|
+        end : []).flatten.select { |op| op }.inject(params.dup) do |result, fop|
           fop.params.each_key do |k|
             if result.has_key?(k)
               raise DuplicateParamException, "Parameter '#{k}' for operation #{fop.name} in collection #{@collection.name}"
-- 
1.7.4.4


Re: [PATCH core 3/5] Core: Make 'features' optional for driver

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2011-11-23 at 17:23 +0100, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/lib/sinatra/rabbit.rb |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

ACK; though wouldn't it be simpler to have a base class for
CIMI::Drivers with a features method that always returns [] ?

David