deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: Openstack driver - adds forced_authentication for /api
Date Thu, 13 Sep 2012 10:01:03 GMT
Updated Branches:
  refs/heads/master e7dbe369a -> 01cde96b7


Openstack driver - adds forced_authentication for /api

checks if OS provider supports buckets collection (is swift deployed?)

related to https://issues.apache.org/jira/browse/DTACLOUD-316
https://github.com/ruby-openstack/ruby-openstack/pull/13


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/01cde96b
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/01cde96b
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/01cde96b

Branch: refs/heads/master
Commit: 01cde96b7e2c808dc1c94b83904256a7433cff41
Parents: e7dbe36
Author: marios <marios@redhat.com>
Authored: Thu Sep 13 12:59:46 2012 +0300
Committer: marios <marios@redhat.com>
Committed: Thu Sep 13 13:00:34 2012 +0300

----------------------------------------------------------------------
 .../drivers/openstack/openstack_driver.rb          |   19 ++++++++++----
 server/lib/deltacloud/server.rb                    |    6 ++++-
 2 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01cde96b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01cde96b/server/lib/deltacloud/server.rb
----------------------------------------------------------------------
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" }


Mime
View raw message