From aa707d665e71835aa4221049797dc6c726de0638 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 4 Nov 2023 09:31:54 +0100 Subject: [PATCH] [PR #7467/a366318a backport][stable-7] [gitlab] Fix gitlab constants calls (#7473) [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 8f8b23e0c0..ee44c62747 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 177bec072d..3dd894ac2c 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 63599f4b45..2b5d2b5871 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 c216f643fd..77365fe19f 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, } '''