You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/02/21 15:50:12 UTC
[PATCH core 2/3] Fixed client to use new relative URLs in HATEOAS
From: Michal Fojtik <mf...@redhat.com>
---
client/lib/deltacloud.rb | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index de747e9..6d00af8 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -75,6 +75,8 @@ module DeltaCloud
@api_driver, @api_provider = opts[:driver], opts[:provider]
@username, @password = opts[:username] || user_name, opts[:password] || password
@api_uri = URI.parse(api_url)
+ @api_path = @api_uri.path
+ @api_uri = URI.parse("#{@api_uri.scheme}://#{@api_uri.host}:#{@api_uri.port}")
@features, @entry_points = {}, {}
@verbose = opts[:verbose] || false
discover_entry_points
@@ -124,7 +126,7 @@ module DeltaCloud
def api_port; @api_uri.port ; end
# Return API path
- def api_path; @api_uri.path ; end
+ def api_path; @api_path ; end
# Define methods based on 'rel' attribute in entry point
# Two methods are declared: 'images' and 'image'
@@ -319,6 +321,7 @@ module DeltaCloud
:timeout => args[4] || 45,
:open_timeout => args[5] || 10
}
+
if conf[:query_args] != {}
conf[:path] += '?' + URI.escape(conf[:query_args].collect{ |key, value| "#{key}=#{value}" }.join('&')).to_s
end
--
1.7.4