mirror of
https://github.com/ceph/ceph
synced 2025-03-19 00:45:00 +00:00
mgr: fix subuser creation via dashboard
Subusers couldn't be created through the dashboard, because the get call was overwritten with Python magic due to it being the function under the HTTP call.
The get function was therefore split into an "external" and "internal" function, whereas one
can be used by functions without triggering the magic. Since the user object was then returned correctly, json.loads could be removed.
Signed-off-by: Hannes Baum <hannes.baum@cloudandheat.com>
(cherry picked from commit 90e221d0b5
)
This commit is contained in:
parent
aa0fc9b6e8
commit
2036e87b91
@ -805,7 +805,7 @@ class RgwUserSubuserTest(RgwTestCase):
|
||||
'access': 'readwrite',
|
||||
'key_type': 'swift'
|
||||
})
|
||||
self.assertStatus(200)
|
||||
self.assertStatus(201)
|
||||
data = self.jsonBody()
|
||||
subuser = self.find_object_in_list('id', 'teuth-test-user:tux', data)
|
||||
self.assertIsInstance(subuser, object)
|
||||
@ -828,7 +828,7 @@ class RgwUserSubuserTest(RgwTestCase):
|
||||
'access_key': 'yyy',
|
||||
'secret_key': 'xxx'
|
||||
})
|
||||
self.assertStatus(200)
|
||||
self.assertStatus(201)
|
||||
data = self.jsonBody()
|
||||
subuser = self.find_object_in_list('id', 'teuth-test-user:hugo', data)
|
||||
self.assertIsInstance(subuser, object)
|
||||
|
@ -576,6 +576,9 @@ class RgwUser(RgwRESTController):
|
||||
return users
|
||||
|
||||
def get(self, uid, daemon_name=None, stats=True) -> dict:
|
||||
return self._get(uid, daemon_name=daemon_name, stats=stats)
|
||||
|
||||
def _get(self, uid, daemon_name=None, stats=True) -> dict:
|
||||
query_params = '?stats' if stats else ''
|
||||
result = self.proxy(daemon_name, 'GET', 'user{}'.format(query_params),
|
||||
{'uid': uid, 'stats': stats})
|
||||
@ -590,7 +593,7 @@ class RgwUser(RgwRESTController):
|
||||
# type: (Optional[str]) -> List[str]
|
||||
emails = []
|
||||
for uid in json.loads(self.list(daemon_name)): # type: ignore
|
||||
user = json.loads(self.get(uid, daemon_name)) # type: ignore
|
||||
user = self._get(uid, daemon_name) # type: ignore
|
||||
if user["email"]:
|
||||
emails.append(user["email"])
|
||||
return emails
|
||||
@ -710,7 +713,7 @@ class RgwUser(RgwRESTController):
|
||||
secret_key=None, daemon_name=None):
|
||||
# pylint: disable=R1705
|
||||
subusr_array = []
|
||||
user = json.loads(self.get(uid, daemon_name)) # type: ignore
|
||||
user = self._get(uid, daemon_name) # type: ignore
|
||||
subusers = user["subusers"]
|
||||
for sub_usr in subusers:
|
||||
subusr_array.append(sub_usr["id"])
|
||||
|
Loading…
Reference in New Issue
Block a user