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

Fix orchestration request status codes.

Make the OpenStack Orchestration return codes match what
actually gets returned from Heat.
This commit is contained in:
Dan Prince 2013-10-02 09:21:25 -04:00
parent 1854e9a040
commit d49b10b1dc
5 changed files with 15 additions and 4 deletions

View file

@ -22,6 +22,7 @@ module Fog
}.merge(options) }.merge(options)
request( request(
:expects => 201,
:path => 'stacks', :path => 'stacks',
:method => 'POST', :method => 'POST',
:body => MultiJson.encode(params) :body => MultiJson.encode(params)
@ -45,8 +46,10 @@ module Fog
} }
response = Excon::Response.new response = Excon::Response.new
response.status = 202 response.status = 201
response.body = {} response.body = {
'id' => stack_id,
'links'=>[{"href"=>"http://localhost:8004/v1/fake_tenant_id/stacks/#{stack_name}/#{stack_id}", "rel"=>"self"}]}
response response
end end
end end

View file

@ -14,6 +14,7 @@ module Fog
def delete_stack(stack_name, stack_id) def delete_stack(stack_name, stack_id)
request( request(
:expects => 204,
:path => "stacks/#{stack_name}/#{stack_id}", :path => "stacks/#{stack_name}/#{stack_id}",
:method => 'DELETE' :method => 'DELETE'
) )
@ -26,7 +27,7 @@ module Fog
self.data[:stacks].delete(stack_id) self.data[:stacks].delete(stack_id)
response = Excon::Response.new response = Excon::Response.new
response.status = 202 response.status = 204
response.body = {} response.body = {}
response response
end end

View file

@ -25,6 +25,7 @@ module Fog
def list_stacks(options = {}) def list_stacks(options = {})
request( request(
:expects => 200,
:path => 'stacks', :path => 'stacks',
:method => 'GET', :method => 'GET',
:query => options :query => options

View file

@ -20,6 +20,7 @@ module Fog
}.merge(options) }.merge(options)
request( request(
:expects => 202,
:path => 'stacks', :path => 'stacks',
:method => 'PUT', :method => 'PUT',
:body => MultiJson.encode(params) :body => MultiJson.encode(params)

View file

@ -10,8 +10,13 @@ Shindo.tests('Fog::Orchestration[:openstack] | stack requests', ['openstack']) d
'updated_time' => Time 'updated_time' => Time
} }
@create_format = {
'id' => String,
'links' => Array,
}
tests('success') do tests('success') do
tests('#create_stack("teststack")').formats({}) do tests('#create_stack("teststack")').formats(@create_format) do
Fog::Orchestration[:openstack].create_stack("teststack").body Fog::Orchestration[:openstack].create_stack("teststack").body
end end