Fix issue with package loader

Pagination for Catalog API was introduced in change
If71da70fa835a1ee7a271ebf7238c0a4c64d4123
but package loader was not updated to handle changed
result type for call to GET /catalog/packages

Change-Id: If79efe560801bb33a36e2b0032a71cdbe191fb03
Closes-bug: #1325365
This commit is contained in:
Serg Melikyan 2014-06-01 17:28:38 +04:00
parent da7fda4832
commit 744eee2a84
1 changed files with 3 additions and 2 deletions

View File

@ -130,13 +130,14 @@ class ApiPackageLoader(PackageLoader):
def _get_definition(self, filter_opts):
try:
packages = self._client.packages.filter(**filter_opts)
if not packages:
try:
return packages.next()
except StopIteration:
LOG.debug('There are no packages matching filter '
'{0}'.format(filter_opts))
# TODO(smelikyan): This exception should be replaced with one
# defined in python-muranoclient
raise LookupError()
return packages[0]
except muranoclient_exc.HTTPException:
LOG.debug('Failed to get package definition from repository')
raise LookupError()