1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack] Fix authentication without specifying tenant name

Signed-off-by: Nelvin Driz <nelvindriz@live.com>
This commit is contained in:
Nelvin Driz 2012-04-19 22:06:36 +08:00
parent b0263c1ecf
commit aa79bf47fc

View file

@ -108,14 +108,13 @@ module Fog
unless svc unless svc
unless @openstack_tenant unless @openstack_tenant
response = connection.request({ response = Fog::Connection.new(
"#{uri.scheme}://#{uri.host}:5000/v2.0/tenants", false).request({
:expects => [200, 204], :expects => [200, 204],
:headers => {'Content-Type' => 'application/json', :headers => {'Content-Type' => 'application/json',
'X-Auth-Token' => body['access']['token']['id']}, 'X-Auth-Token' => body['access']['token']['id']},
:host => uri.host, :host => uri.host,
:method => 'GET', :method => 'GET'
:path => '/v2.0/tenants',
:port => '5000'
}) })
body = MultiJson.decode(response.body) body = MultiJson.decode(response.body)
@ -124,7 +123,9 @@ module Fog
body = retrieve_tokens_v2(connection, req_body, uri) body = retrieve_tokens_v2(connection, req_body, uri)
svc = body['access']['serviceCatalog']. 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 end
mgmt_url = svc['endpoints'].detect{|x| x[@endpoint_type]}[@endpoint_type] mgmt_url = svc['endpoints'].detect{|x| x[@endpoint_type]}[@endpoint_type]