deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: [PATCH core 1/6] Client: Handle 301 correctly for API entrypoint
Date Tue, 20 Mar 2012 14:24:24 GMT
ack series


On 20/03/12 15:28, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mfojtik@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> ---
>  client/lib/deltacloud.rb |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> 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