[Trivial] Fix swift's extension discovery

In case the swift's endpoint returned an exception during an
extension query, get_capabilities method returned a string of
an empty dict, which is always "true" and therefore it confues
a later if statement checking if any extensions were found.
Let's make the method return an object - dict - which will
be either true (if contains any data) or false (if it's empty).

Change-Id: Ie7974c97a4b119e41fba7150bcd2a2553300f694
This commit is contained in:
Martin Kopec 2021-08-29 17:09:01 +00:00
parent 0398f2a6c0
commit 2bf7bf6a84
1 changed files with 1 additions and 2 deletions

View File

@ -32,7 +32,6 @@ class ObjectStorageService(Service):
# (e.g.: when ceph is on swift)
capabilities = self.get_capabilities('swift/info')
capabilities = json.loads(capabilities)
# Remove Swift general information from extensions list
capabilities.pop('swift', {})
self.extensions = capabilities.keys()
@ -48,7 +47,7 @@ class ObjectStorageService(Service):
LOG.warning('Object storage %s API endpoint not discovered. '
'Error message: %s', path, e)
return body
return json.loads(body)
def list_create_roles(self, conf, client):
try: