deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] Core: Prevent hash_capability to fail finding methods (DTACLOUD-265)
Date Wed, 08 Aug 2012 09:24:35 GMT
From: Michal Fojtik <mfojtik@redhat.com>

* When the driver inherits its methods from other driver,
  the has_capability failed to find them, which cause to
  not advertise them.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/base_driver.rb |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb
index 21e4382..30d0f92 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -157,7 +157,11 @@ module Deltacloud
 
     def has_capability?(method)
       method = (RUBY_VERSION =~ /^1\.9/) ? method : method.to_s
-      (self.class.instance_methods - self.class.superclass.instance_methods).include? method
+      # Prevent has_capability fail when driver is inherited from another
+      # driver, like Eucalyptus
+      superclass_methods = self.class.superclass.name == 'Deltacloud::BaseDriver' ?
+        self.class.superclass.instance_methods : []
+      (self.class.instance_methods - superclass_methods).include? method
     end
 
     ## Capabilities
-- 
1.7.10.2


Mime
View raw message