lib/yao/client.rb in yao-0.2.10 vs lib/yao/client.rb in yao-0.2.11
- old
+ new
@@ -25,16 +25,17 @@
def register_endpoints(endpoints, token: nil)
endpoints.each_pair do |type, urls|
# XXX: neutron just have v2.0 API and endpoint may not have version prefix
if type == "network"
urls = urls.map {|public_or_admin, url|
- url = URI.parse(url).path == "/" ? File.join(url, "v2.0") : url
+ path = URI.parse(url).path
+ url = (path == '' || path == '/') ? File.join(url, "v2.0") : url
[public_or_admin, url]
}.to_h
end
- self.pool[type] = Yao::Client.gen_client(urls[:public_url], token: token)
- self.admin_pool[type] = Yao::Client.gen_client(urls[:admin_url], token: token)
+ self.pool[type] = Yao::Client.gen_client(urls[:public_url], token: token) if urls[:public_url]
+ self.admin_pool[type] = Yao::Client.gen_client(urls[:admin_url], token: token) if urls[:admin_url]
end
end
end
class << self