deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject git commit: Core: Prevent hash_capability to fail finding methods (DTACLOUD-265)
Date Mon, 13 Aug 2012 14:55:52 GMT
Updated Branches:
  refs/heads/master a2df7f40d -> dfa9c3535


Core: Prevent hash_capability to fail finding methods (DTACLOUD-265)

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


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/dfa9c353
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/dfa9c353
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/dfa9c353

Branch: refs/heads/master
Commit: dfa9c3535f0705ead13a18e0016ca6333b74a6c4
Parents: a2df7f4
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Aug 8 11:22:57 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Aug 13 16:56:20 2012 +0200

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/base_driver.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/dfa9c353/server/lib/deltacloud/drivers/base_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb
index 6687a24..f5124f4 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -156,7 +156,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


Mime
View raw message