Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 33519CFDB for ; Fri, 11 May 2012 10:41:18 +0000 (UTC) Received: (qmail 78793 invoked by uid 500); 11 May 2012 10:41:18 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 78622 invoked by uid 500); 11 May 2012 10:41:14 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 78555 invoked by uid 99); 11 May 2012 10:41:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2012 10:41:12 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2012 10:41:06 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4BAeicS010640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 May 2012 06:40:44 -0400 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4BAegTm001194 for ; Fri, 11 May 2012 06:40:44 -0400 From: mfojtik@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH core 2/3] Core: Fix incompatibility between 1.9 and 1.8 ruby in listing methods Date: Fri, 11 May 2012 12:41:39 +0200 Message-Id: <1336732900-70779-2-git-send-email-mfojtik@redhat.com> In-Reply-To: <1336732900-70779-1-git-send-email-mfojtik@redhat.com> References: <1336732900-70779-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org From: Michal Fojtik Signed-off-by: Michal fojtik --- 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