diff --git a/zuul_registry/swift.py b/zuul_registry/swift.py index 6c28282..80ef2b7 100644 --- a/zuul_registry/swift.py +++ b/zuul_registry/swift.py @@ -65,7 +65,19 @@ class SwiftDriver(storageutils.StorageDriver): def list_objects(self, path): self.log.debug("List objects %s", path) - url = self.get_url('') + '?prefix=%s&delimiter=/&format=json' % (path,) + marker = '' + ret = [] + while inner_ret := self._list_objects(path, marker): + # Swift limits the total number of responses per request + # (typically 10k) so we have to paginate and accumulate responses. + ret.extend(inner_ret) + marker = inner_ret[-1].path + return ret + + def _list_objects(self, path, marker): + # TODO should path and marker be url encoded? + url = self.get_url('') + \ + '?prefix=%s&delimiter=/&format=json&marker=%s' % (path, marker) ret = retry_function( lambda: self.conn.session.get(url).content.decode('utf8')) data = json.loads(ret)