Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib/miasma/contrib/open_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ def authentication_request
)
)
else
if(credentials[:open_stack_domain])
if(credentials[:open_stack_project])
scope = Smash.new(
:domain => Smash.new(
:name => credentials[:open_stack_domain]
:project => Smash.new(
:name => credentials[:open_stack_project]
)
)
if(credentials[:open_stack_project])
scope[:project] = Smash.new(
:name => credentials[:open_stack_project]
if(credentials[:open_stack_domain])
scope[:project][:domain] = Smash.new(
:name => credentials[:open_stack_domain]
)
end
end
Expand All @@ -186,7 +186,7 @@ def identify_and_load
:auth => authentication_request
)
)
unless(result.status == 200)
unless(result.status == 200 || result.status == 201)
raise Error::ApiError::AuthenticationError.new('Failed to authenticate!', result)
end
info = MultiJson.load(result.body.to_s).to_smash[:token]
Expand Down Expand Up @@ -314,7 +314,9 @@ def endpoint_for(api_name, region)
end
if(region)
point = srv[:endpoints].detect do |endpoint|
endpoint[:region].to_s.downcase == region.to_s.downcase
if(endpoint[:interface].to_s.downcase == "public")
endpoint[:region].to_s.downcase == region.to_s.downcase
end
end
else
point = srv[:endpoints].first
Expand All @@ -340,4 +342,4 @@ def api_token
Models::Compute.autoload :OpenStack, 'miasma/contrib/open_stack/compute'
Models::Orchestration.autoload :OpenStack, 'miasma/contrib/open_stack/orchestration'
Models::Storage.autoload :OpenStack, 'miasma/contrib/open_stack/storage'
end
end