Adopt new api for artifact listing

In change Ic0762f7a379754d19147a4f41a6d5a98abdc86b0
we renamed <type_name> section to unified 'artifacts'.

We need to reflect this changes in the client, otherwise
it doesn't work.

Change-Id: I10e5b5678180586d6f09b8dd4d83fb3f45e1f569
This commit is contained in:
Mike Fedosin 2018-01-10 17:23:21 +01:00 committed by Idan Narotzki
parent bf74fb428e
commit 6da299f345
1 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ class Controller(object):
type_name = self._check_type_name(type_name)
url = '/artifacts/%s?version=%s&name=%s' % (type_name, version, name)
resp, body = self.http_client.get(url)
arts = body[type_name]
arts = body.get('artifacts', body.get(type_name))
if not arts:
msg = ('Artifact with name=%s and version=%s not found.' %
(name, version))
@ -138,7 +138,7 @@ class Controller(object):
' Please provide the concrete id from the list:\n%s' %
(name, version, output))
raise exc.BadRequest(msg)
return body[type_name][0]
return arts[0]
def list(self, type_name=None, **kwargs):
"""Retrieve a listing of artifacts objects.