mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace|identity] Handle non-array responses from list calls.
This commit is contained in:
parent
21c0fd079f
commit
788d452df2
4 changed files with 32 additions and 4 deletions
|
@ -3,11 +3,18 @@ module Fog
|
|||
class Identity
|
||||
class Real
|
||||
def list_credentials(user_id)
|
||||
request(
|
||||
response = request(
|
||||
:expects => [200, 203],
|
||||
:method => 'GET',
|
||||
:path => "users/#{user_id}/OS-KSADM/credentials"
|
||||
)
|
||||
|
||||
if response.body.include? 'credential'
|
||||
response.body['credentials'] = [response.body['credential']]
|
||||
response.body.delete('credential')
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,18 @@ module Fog
|
|||
class Identity
|
||||
class Real
|
||||
def list_tenants()
|
||||
request(
|
||||
response = request(
|
||||
:expects => [200, 203],
|
||||
:method => 'GET',
|
||||
:path => 'tenants'
|
||||
)
|
||||
|
||||
if response.body.include? 'tenant'
|
||||
response.body['tenants'] = [response.body['tenant']]
|
||||
response.body.delete('tenant')
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,18 @@ module Fog
|
|||
class Identity
|
||||
class Real
|
||||
def list_user_roles(user_id)
|
||||
request(
|
||||
response = request(
|
||||
:expects => [200, 203],
|
||||
:method => 'GET',
|
||||
:path => "users/#{user_id}/roles"
|
||||
)
|
||||
|
||||
if response.body.include? 'role'
|
||||
response.body['roles'] = [response.body['role']]
|
||||
response.body.delete('role')
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,18 @@ module Fog
|
|||
class Identity
|
||||
class Real
|
||||
def list_users()
|
||||
request(
|
||||
response = request(
|
||||
:expects => [200, 203],
|
||||
:method => 'GET',
|
||||
:path => 'users'
|
||||
)
|
||||
|
||||
if response.body.include? 'user'
|
||||
response.body['users'] = [response.body['user']]
|
||||
response.body.delete('user')
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue