From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]> --- 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
