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/05/11 12:41:39 UTC
[PATCH core 2/3] Core: Fix incompatibility between 1.9 and 1.8 ruby in listing methods
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/deltacloud/drivers/base_driver.rb | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb
index ab8fb1a..a100828 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -104,16 +104,13 @@ module Deltacloud
hwp = nil
if name
unless hwp = hardware_profiles(credentials, :id => name).first
- raise BackendError.new(400, "bad-hardware-profile-name",
- "Hardware profile '#{name}' does not exist", nil)
+ raise BackendError.new(StandardError.new, "Hardware profile '#{name}' does not exist")
end
else
- unless image = image(credentials, :id=>image_id)
- raise BackendError.new(400, "bad-image-id",
- "Image with ID '#{image_id}' does not exist", nil)
+ unless image = image(credentials, :id => image_id)
+ raise BackendError.new(StandardError.new, "Image with ID '#{image_id}' does not exist")
end
- hwp = hardware_profiles(credentials,
- :architecture=>image.architecture).first
+ hwp = hardware_profiles(credentials, :architecture=>image.architecture).first
end
return hwp
end
@@ -144,7 +141,8 @@ module Deltacloud
end
def has_capability?(method)
- (self.class.instance_methods - self.class.superclass.instance_methods).include? method.to_s
+ method = RUBY_VERSION =~ /^1\.9/ ? method : method.to_s
+ (self.class.instance_methods - self.class.superclass.instance_methods).include? method
end
## Capabilities
--
1.7.10.1