From cc6d4209d4850ba2e194af41986b058580da5d10 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 4 Nov 2023 12:35:59 +0100 Subject: [PATCH] [PR #7467/a366318a backport][stable-6] [gitlab] Fix gitlab constants calls (#7475) [gitlab] Fix gitlab constants calls (#7467) fix: Fix gitlab constants calls Co-authored-by: Arnaud Hatzenbuhler (cherry picked from commit a366318ac683303d05e14d4a7cbac9c7e2fe3077) Co-authored-by: Arnaud Hatzenbuhler --- .../fragments/7467-fix-gitlab-constants-calls.yml | 5 +++++ plugins/modules/gitlab_group_members.py | 10 +++++----- plugins/modules/gitlab_project_members.py | 8 ++++---- plugins/modules/gitlab_protected_branch.py | 6 +++--- plugins/modules/gitlab_user.py | 12 ++++++------ 5 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 changelogs/fragments/7467-fix-gitlab-constants-calls.yml diff --git a/changelogs/fragments/7467-fix-gitlab-constants-calls.yml b/changelogs/fragments/7467-fix-gitlab-constants-calls.yml new file mode 100644 index 0000000000..77466f75e6 --- /dev/null +++ b/changelogs/fragments/7467-fix-gitlab-constants-calls.yml @@ -0,0 +1,5 @@ +bugfixes: + - gitlab_group_members - fix gitlab constants call in ``gitlab_group_members`` module (https://github.com/ansible-collections/community.general/issues/7467). + - gitlab_project_members - fix gitlab constants call in ``gitlab_project_members`` module (https://github.com/ansible-collections/community.general/issues/7467). + - gitlab_protected_branches - fix gitlab constants call in ``gitlab_protected_branches`` module (https://github.com/ansible-collections/community.general/issues/7467). + - gitlab_user - fix gitlab constants call in ``gitlab_user`` module (https://github.com/ansible-collections/community.general/issues/7467). diff --git a/plugins/modules/gitlab_group_members.py b/plugins/modules/gitlab_group_members.py index 66298e882c..dd600ea906 100644 --- a/plugins/modules/gitlab_group_members.py +++ b/plugins/modules/gitlab_group_members.py @@ -276,11 +276,11 @@ def main(): ensure_gitlab_package(module) access_level_int = { - 'guest': gitlab.GUEST_ACCESS, - 'reporter': gitlab.REPORTER_ACCESS, - 'developer': gitlab.DEVELOPER_ACCESS, - 'maintainer': gitlab.MAINTAINER_ACCESS, - 'owner': gitlab.OWNER_ACCESS, + 'guest': gitlab.const.GUEST_ACCESS, + 'reporter': gitlab.const.REPORTER_ACCESS, + 'developer': gitlab.const.DEVELOPER_ACCESS, + 'maintainer': gitlab.const.MAINTAINER_ACCESS, + 'owner': gitlab.const.OWNER_ACCESS, } gitlab_group = module.params['gitlab_group'] diff --git a/plugins/modules/gitlab_project_members.py b/plugins/modules/gitlab_project_members.py index 9053584431..8c32fc3f77 100644 --- a/plugins/modules/gitlab_project_members.py +++ b/plugins/modules/gitlab_project_members.py @@ -282,10 +282,10 @@ def main(): ensure_gitlab_package(module) access_level_int = { - 'guest': gitlab.GUEST_ACCESS, - 'reporter': gitlab.REPORTER_ACCESS, - 'developer': gitlab.DEVELOPER_ACCESS, - 'maintainer': gitlab.MAINTAINER_ACCESS, + 'guest': gitlab.const.GUEST_ACCESS, + 'reporter': gitlab.const.REPORTER_ACCESS, + 'developer': gitlab.const.DEVELOPER_ACCESS, + 'maintainer': gitlab.const.MAINTAINER_ACCESS, } gitlab_project = module.params['project'] diff --git a/plugins/modules/gitlab_protected_branch.py b/plugins/modules/gitlab_protected_branch.py index fea374cbfd..89796856f6 100644 --- a/plugins/modules/gitlab_protected_branch.py +++ b/plugins/modules/gitlab_protected_branch.py @@ -94,9 +94,9 @@ class GitlabProtectedBranch(object): self._module = module self.project = self.get_project(project) self.ACCESS_LEVEL = { - 'nobody': gitlab.NO_ACCESS, - 'developer': gitlab.DEVELOPER_ACCESS, - 'maintainer': gitlab.MAINTAINER_ACCESS + 'nobody': gitlab.const.NO_ACCESS, + 'developer': gitlab.const.DEVELOPER_ACCESS, + 'maintainer': gitlab.const.MAINTAINER_ACCESS } def get_project(self, project_name): diff --git a/plugins/modules/gitlab_user.py b/plugins/modules/gitlab_user.py index 94f3713160..045dc7d766 100644 --- a/plugins/modules/gitlab_user.py +++ b/plugins/modules/gitlab_user.py @@ -244,12 +244,12 @@ class GitLabUser(object): self._gitlab = gitlab_instance self.user_object = None self.ACCESS_LEVEL = { - 'guest': gitlab.GUEST_ACCESS, - 'reporter': gitlab.REPORTER_ACCESS, - 'developer': gitlab.DEVELOPER_ACCESS, - 'master': gitlab.MAINTAINER_ACCESS, - 'maintainer': gitlab.MAINTAINER_ACCESS, - 'owner': gitlab.OWNER_ACCESS, + 'guest': gitlab.const.GUEST_ACCESS, + 'reporter': gitlab.const.REPORTER_ACCESS, + 'developer': gitlab.const.DEVELOPER_ACCESS, + 'master': gitlab.const.MAINTAINER_ACCESS, + 'maintainer': gitlab.const.MAINTAINER_ACCESS, + 'owner': gitlab.const.OWNER_ACCESS, } '''