deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [2/11] git commit: CIMI: Added support for X-Deltacloud-Provider and Driver to client
Date Mon, 27 Feb 2012 16:44:47 GMT
CIMI: Added support for X-Deltacloud-Provider and Driver to client

With this patch, client should be able to change default
CIMI driver. In addition this change will make API_PROVIDER
change possible.


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

Branch: refs/heads/master
Commit: 57ff80e479b949dd95d8b2fdb6e48422e2a5bea2
Parents: 728f1cd
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Feb 23 14:52:49 2012 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Fri Feb 24 16:40:02 2012 +0100

----------------------------------------------------------------------
 clients/cimi/lib/client.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/57ff80e4/clients/cimi/lib/client.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/client.rb b/clients/cimi/lib/client.rb
index 3b8bc34..0fd85e4 100644
--- a/clients/cimi/lib/client.rb
+++ b/clients/cimi/lib/client.rb
@@ -41,9 +41,17 @@ module CIMI
         client["%s/%s/%s" % [entity_type, id, action.to_s]].post(body, auth_header(credentials))
       end
 
+      def provider_header(credentials)
+        return Hash.new unless credentials.driver
+        {
+          :'X-Deltacloud-Driver' => credentials.driver,
+          :'X-Deltacloud-Provider' => credentials.provider
+        }
+      end
+
       def auth_header(credentials)
         encoded_credentials = ["#{credentials.user}:#{credentials.password}"].pack("m0").gsub(/\n/,'')
-        { :authorization => "Basic " + encoded_credentials }
+        { :authorization => "Basic " + encoded_credentials }.merge(provider_header(credentials))
       end
 
     end


Mime
View raw message