Make separate Bay objects for each bay object

The previous list code was not creating separate bay objects per
bay object returned by the server with the new versioned objects
code.  This results in getattr not able to retrieve the value of
the attribute resulting in no content.

Change-Id: I2bd7efe73871e6d9783683ba9301ca10f381a9fc
This commit is contained in:
Steven Dake 2014-12-02 02:57:14 -07:00
parent c974b2be57
commit 46b515eb24
2 changed files with 7 additions and 11 deletions

View File

@ -33,12 +33,12 @@ class BayManager(base.Manager):
def _path(id=None): def _path(id=None):
return '/v1/bays/%s' % id if id else '/v1/bays' return '/v1/bays/%s' % id if id else '/v1/bays'
def list(self, marker=None, limit=None, sort_key=None, def list(self, limit=None, marker=None, sort_key=None,
sort_dir=None, detail=False): sort_dir=None, detail=False):
"""Retrieve a list of bays. """Retrieve a list of port.
:param marker: Optional, the UUID of a bays, eg the last :param marker: Optional, the UUID of a port, eg the last
bays from a previous result set. Return port from a previous result set. Return
the next result set. the next result set.
:param limit: The maximum number of results to return per :param limit: The maximum number of results to return per
request, if: request, if:
@ -72,13 +72,9 @@ class BayManager(base.Manager):
path += '?' + '&'.join(filters) path += '?' + '&'.join(filters)
if limit is None: if limit is None:
# TODO(yuanying): if endpoint returns "map", return self._list(self._path(path), "bays")
# change None to response_key
return self._list(self._path(path), None)
else: else:
# TODO(yuanying): if endpoint returns "map", return self._list_pagination(self._path(path), "bays",
# change None to response_key
return self._list_pagination(self._path(path), None,
limit=limit) limit=limit)
def get(self, id): def get(self, id):

View File

@ -35,7 +35,7 @@ def _show_bay(bay):
def do_bay_list(cs, args): def do_bay_list(cs, args):
"""Print a list of available bays.""" """Print a list of available bays."""
bays = cs.bays.list() bays = cs.bays.list()
columns = ('id', 'name', 'type') columns = ('uuid', 'name', 'type')
utils.print_list(bays, columns, utils.print_list(bays, columns,
{'versions': _print_list_field('versions')}) {'versions': _print_list_field('versions')})