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 2F6D9DC0D for ; Thu, 13 Sep 2012 09:02:37 +0000 (UTC) Received: (qmail 64379 invoked by uid 500); 13 Sep 2012 09:02:37 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 64139 invoked by uid 500); 13 Sep 2012 09:02:30 -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 64107 invoked by uid 99); 13 Sep 2012 09:02:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2012 09:02:29 +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; Thu, 13 Sep 2012 09:02:24 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8D923wO018309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Sep 2012 05:02:03 -0400 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8D920FC028001 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 13 Sep 2012 05:02:02 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) Subject: Re: [PATCH] Openstack driver - adds forced_authentication for /api... checks whether Openstack provider supports buckets collection (is swift service deployed?) From: Michal Fojtik In-Reply-To: <1347453142-16940-1-git-send-email-marios@redhat.com> Date: Thu, 13 Sep 2012 11:02:53 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <66C39D35-1762-4BEB-BE17-5EE28639E214@redhat.com> References: <1347453142-16940-1-git-send-email-marios@redhat.com> To: dev@deltacloud.apache.org X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Virus-Checked: Checked by ClamAV on apache.org On Sep 12, 2012, at 2:32 PM, marios@redhat.com wrote: ACK. One nit, can you please make the first line in commit shorter before push? -- Michal > From: marios >=20 > related to https://issues.apache.org/jira/browse/DTACLOUD-316 > https://github.com/ruby-openstack/ruby-openstack/pull/13 >=20 > Signed-off-by: marios > --- > .../deltacloud/drivers/openstack/openstack_driver.rb | 19 = +++++++++++++------ > server/lib/deltacloud/server.rb | 6 +++++- > 2 files changed, 18 insertions(+), 7 deletions(-) >=20 > diff --git = a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb = b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb > index 5b29840..ca824bd 100644 > --- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb > +++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb > @@ -40,6 +40,19 @@ module Deltacloud >=20 > define_hardware_profile('default') >=20 > + def respond_to?(capability)#, credentials) > + if capability =3D=3D :buckets > + begin > + client =3D = new_client(Deltacloud.config["openstack_creds"], capability) > + rescue Deltacloud::ExceptionHandler::NotImplemented = #OpenStack::Exception::NotImplemented... > + return false > + end > + return true > + else > + super(capability) > + end > + end > + > def hardware_profiles(credentials, opts =3D {}) > os =3D new_client(credentials) > results =3D [] > @@ -351,12 +364,6 @@ private > end > end >=20 > - def cloudfiles_client(credentials) > - safely do > - CloudFiles::Connection.new(:username =3D> = credentials.user, :api_key =3D> credentials.password) > - end > - end > - > #NOTE: for the convert_from_foo methods below... openstack-compute > #gives Hash for 'flavors' but OpenStack::Compute::Flavor for 'flavor' > #hence the use of 'send' to deal with both cases and save duplication > diff --git a/server/lib/deltacloud/server.rb = b/server/lib/deltacloud/server.rb > index c7c6c41..4b9485e 100644 > --- a/server/lib/deltacloud/server.rb > +++ b/server/lib/deltacloud/server.rb > @@ -44,8 +44,12 @@ module Deltacloud > set :config, Deltacloud[:deltacloud] >=20 > get '/' do > - if params[:force_auth] > + if driver.name =3D=3D "openstack" or params[:force_auth] > return [401, 'Authentication failed'] unless = driver.valid_credentials?(credentials) > + if driver.name =3D=3D "openstack" > + Deltacloud.config["openstack_creds"] =3D credentials > + #or here also works: Thread.current["openstack_creds"] =3D = credentials > + end > end > respond_to do |format| > format.xml { haml :"api/show" } > --=20 > 1.7.11.4 >=20 Michal Fojtik http://deltacloud.org mfojtik@redhat.com