Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 30416 invoked from network); 9 Nov 2010 13:25:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Nov 2010 13:25:14 -0000 Received: (qmail 97149 invoked by uid 500); 9 Nov 2010 13:25:45 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 97066 invoked by uid 500); 9 Nov 2010 13:25:45 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 96959 invoked by uid 99); 9 Nov 2010 13:25:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Nov 2010 13:25:42 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=10.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tcrawley@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; Tue, 09 Nov 2010 13:25:35 +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.13.8/8.13.8) with ESMTP id oA9DPEjg021764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Nov 2010 08:25:14 -0500 Received: from katahdin.redhat.com (vpn-11-36.rdu.redhat.com [10.11.11.36]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA9DPCoh031377 for ; Tue, 9 Nov 2010 08:25:13 -0500 From: Tobias Crawley To: deltacloud-dev@incubator.apache.org Subject: [PATCH 1/2] Move actual capability test out to its own method. Date: Tue, 9 Nov 2010 08:25:11 -0500 Message-Id: <1289309112-3923-2-git-send-email-tcrawley@redhat.com> In-Reply-To: <1289309112-3923-1-git-send-email-tcrawley@redhat.com> References: <1289309112-3923-1-git-send-email-tcrawley@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org --- server/lib/deltacloud/backend_capability.rb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/server/lib/deltacloud/backend_capability.rb b/server/lib/deltacloud/backend_capability.rb index bec8714..4e6b6a4 100644 --- a/server/lib/deltacloud/backend_capability.rb +++ b/server/lib/deltacloud/backend_capability.rb @@ -13,8 +13,12 @@ module Deltacloud::BackendCapability @capability = capability end + def has_capability?(backend) + !capability or backend.respond_to?(capability) + end + def check_capability(backend) - if capability and !backend.respond_to?(capability) + if !has_capability?(backend) raise Failure.new(capability, "#{capability} capability not supported by backend #{backend.class.name}") end end -- 1.7.2.3