From aa79bf47fc361aa07b33b4159ce420e313895d66 Mon Sep 17 00:00:00 2001 From: Nelvin Driz Date: Thu, 19 Apr 2012 22:06:36 +0800 Subject: [PATCH] [openstack] Fix authentication without specifying tenant name Signed-off-by: Nelvin Driz --- lib/fog/openstack.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/fog/openstack.rb b/lib/fog/openstack.rb index 403d12ae9..a5cd5b70b 100644 --- a/lib/fog/openstack.rb +++ b/lib/fog/openstack.rb @@ -108,14 +108,13 @@ module Fog unless svc unless @openstack_tenant - response = connection.request({ + response = Fog::Connection.new( + "#{uri.scheme}://#{uri.host}:5000/v2.0/tenants", false).request({ :expects => [200, 204], :headers => {'Content-Type' => 'application/json', 'X-Auth-Token' => body['access']['token']['id']}, :host => uri.host, - :method => 'GET', - :path => '/v2.0/tenants', - :port => '5000' + :method => 'GET' }) body = MultiJson.decode(response.body) @@ -124,7 +123,9 @@ module Fog body = retrieve_tokens_v2(connection, req_body, uri) svc = body['access']['serviceCatalog']. - detect{|x| @compute_service_name.include?(x['type']) } + detect{|x| @service_name.include?(x['type']) } + identity_svc = body['access']['serviceCatalog']. + detect{|x| @identity_service_name.include?(x['type']) } if @identity_service_name end mgmt_url = svc['endpoints'].detect{|x| x[@endpoint_type]}[@endpoint_type]