mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
6dee2184e8
Instead of simply checking for the existence of a key in Identity API responses, this checks the type of the expected response. This should be a less fragile way of handling hash/array responses.
22 lines
470 B
Ruby
22 lines
470 B
Ruby
module Fog
|
|
module Rackspace
|
|
class Identity
|
|
class Real
|
|
def list_tenants()
|
|
response = request(
|
|
:expects => [200, 203],
|
|
:method => 'GET',
|
|
:path => 'tenants'
|
|
)
|
|
|
|
unless response.body['tenants'].is_a?(Array)
|
|
response.body['tenants'] = [response.body['tenant']]
|
|
response.body.delete('tenant')
|
|
end
|
|
|
|
response
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|