From 1c707574cbad739549c322fddf54d98b7d575d57 Mon Sep 17 00:00:00 2001 From: Ofer Koren Date: Thu, 30 Jun 2022 10:54:25 +0300 Subject: [PATCH] bug fix on getting runners as iterator The `gitlab.runners.all(as_list=False)` was ignoring the flag, returning a list regardless --- gitlab/v4/objects/runners.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitlab/v4/objects/runners.py b/gitlab/v4/objects/runners.py index 4f9d7ce57..a0e185782 100644 --- a/gitlab/v4/objects/runners.py +++ b/gitlab/v4/objects/runners.py @@ -98,7 +98,10 @@ def all(self, scope: Optional[str] = None, **kwargs: Any) -> List[Runner]: if scope is not None: query_data["scope"] = scope obj = self.gitlab.http_list(path, query_data, **kwargs) - return [self._obj_cls(self, item) for item in obj] + if isinstance(obj, list): + return [self._obj_cls(self, item, created_from_list=True) for item in obj] + else: + return base.RESTObjectList(self, self._obj_cls, obj) @cli.register_custom_action("RunnerManager", ("token",)) @exc.on_http_error(exc.GitlabVerifyError)