Skip to content

Commit

Permalink
Merge pull request fog#741 from xtoddx/keystone-redux
Browse files Browse the repository at this point in the history
[Compute|OpenStack] match auth response to diablo/stable keystone
  • Loading branch information
xtoddx committed Feb 12, 2012
2 parents b708357 + 045c0a4 commit 20642e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 9 additions & 7 deletions lib/fog/openstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ def self.authenticate_v2(options, connection_options = {})
@compute_service_name = options[:openstack_compute_service_name]

req_body= {
'passwordCredentials' => {
'username' => @openstack_username,
'password' => @openstack_api_key
'auth' => {
'passwordCredentials' => {
'username' => @openstack_username,
'password' => @openstack_api_key
}
}
}
req_body['tenantId'] = @openstack_tenant if @openstack_tenant
req_body['auth']['tenantName'] = @openstack_tenant if @openstack_tenant

response = connection.request({
:expects => [200, 204],
Expand All @@ -96,9 +98,9 @@ def self.authenticate_v2(options, connection_options = {})
})
body=MultiJson.decode(response.body)

if body['auth']['serviceCatalog'] and body['auth']['serviceCatalog'][@compute_service_name] and body['auth']['serviceCatalog'][@compute_service_name][0] then
mgmt_url = body['auth']['serviceCatalog'][@compute_service_name][0]['publicURL']
token = body['auth']['token']['id']
if svc = body['access']['serviceCatalog'].detect{|x| x['name'] == @compute_service_name}
mgmt_url = svc['endpoints'].detect{|x| x['publicURL']}['publicURL']
token = body['access']['token']['id']
return {
:token => token,
:server_management_url => mgmt_url
Expand Down
2 changes: 0 additions & 2 deletions lib/fog/openstack/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ def authenticate
raise Fog::Compute::OpenStack::ServiceUnavailable.new(
"OpenStack binding only supports version 1.1")
end
# Add tenant
@path += @openstack_tenant if @openstack_tenant
@port = uri.port
@scheme = uri.scheme
end
Expand Down

0 comments on commit 20642e0

Please sign in to comment.