deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH] Openstack driver - adds forced_authentication for /api... checks whether Openstack provider supports buckets collection (is swift service deployed?)
Date Thu, 13 Sep 2012 09:02:53 GMT
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 <marios@redhat.com>
> 
> related to https://issues.apache.org/jira/browse/DTACLOUD-316
> https://github.com/ruby-openstack/ruby-openstack/pull/13
> 
> Signed-off-by: marios <marios@redhat.com>
> ---
> .../deltacloud/drivers/openstack/openstack_driver.rb  | 19 +++++++++++++------
> server/lib/deltacloud/server.rb                       |  6 +++++-
> 2 files changed, 18 insertions(+), 7 deletions(-)
> 
> 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
> 
>         define_hardware_profile('default')
> 
> +        def respond_to?(capability)#, credentials)
> +          if capability == :buckets
> +            begin
> +              client = 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 = {})
>           os = new_client(credentials)
>           results = []
> @@ -351,12 +364,6 @@ private
>           end
>         end
> 
> -        def cloudfiles_client(credentials)
> -          safely do
> -            CloudFiles::Connection.new(:username => credentials.user, :api_key =>
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]
> 
>     get '/' do
> -      if params[:force_auth]
> +      if driver.name == "openstack" or params[:force_auth]
>         return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials)
> +        if driver.name == "openstack"
> +          Deltacloud.config["openstack_creds"] = credentials
> +          #or here also works: Thread.current["openstack_creds"] = credentials
> +        end
>       end
>       respond_to do |format|
>         format.xml { haml :"api/show" }
> -- 
> 1.7.11.4
> 

Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com




Mime
View raw message