deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [4/6] git commit: Client: Handle 301 correctly for API entrypoint
Date Tue, 20 Mar 2012 14:37:48 GMT
Client: Handle 301 correctly for API entrypoint


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

Branch: refs/heads/master
Commit: a190f165b0a764a2512f804b9c6f361bb3d81939
Parents: 5483a95
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Tue Mar 20 13:34:22 2012 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Mar 20 15:38:35 2012 +0100

----------------------------------------------------------------------
 client/lib/deltacloud.rb |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a190f165/client/lib/deltacloud.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index e6ae89e..bac3530 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -265,9 +265,13 @@ module DeltaCloud
     def discover_entry_points
       return if discovered?
       request(:get, @api_uri.to_s) do |response|
+        if response.code == 301
+          @api_uri = response.headers[:location]
+          return discover_entry_points
+        end
         api_xml = Nokogiri::XML(response)
-        @driver_name = api_xml.xpath('/api').first['driver']
-        @api_version = api_xml.xpath('/api').first['version']
+        @driver_name = api_xml.xpath('/api').first[:driver]
+        @api_version = api_xml.xpath('/api').first[:version]
 
         api_xml.css("api > link").each do |entry_point|
           rel, href = entry_point['rel'].to_sym, entry_point['href']


Mime
View raw message