Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compute|OpenStack] match auth response to stable/diablo keystone #741

Merged
merged 2 commits into from Feb 12, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/fog/openstack.rb
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
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