Gitlab variables pagination (#968)

* Workaround increasing per_page to max

* Update plugins/modules/source_control/gitlab/gitlab_group_variable.py

* Create 968-gitlab_variables-pagination-increase.yml

* Update changelogs/fragments/968-gitlab_variables-pagination-increase.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/968-gitlab_variables-pagination-increase.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Proper support of pagination

* Fix E303 too many blank lines

* Add test for pagination

* Fix last vars removal test

* Apply suggestions from code review

Check misalignement fixed

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
S Code Man 2020-10-09 20:59:00 +08:00 committed by GitHub
parent 3af4be34b2
commit 98486c0ee2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 170 additions and 8 deletions

View file

@ -155,7 +155,14 @@ class GitlabProjectVariables(object):
return self.repo.projects.get(project_name)
def list_all_project_variables(self):
return self.project.variables.list()
page_nb = 1
variables = []
vars_page = self.project.variables.list(page=page_nb)
while len(vars_page) > 0:
variables += vars_page
page_nb += 1
vars_page = self.project.variables.list(page=page_nb)
return variables
def create_variable(self, key, value, masked, protected, variable_type):
if self._module.check_mode: