deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 6/7] CIMI: Added support for X-Deltacloud-Provider and Driver to client
Date Thu, 23 Feb 2012 13:56:02 GMT
From: Michal Fojtik <mfojtik@redhat.com>

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

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 clients/cimi/lib/client.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

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
-- 
1.7.9.1


Mime
View raw message