From 60a36cac4db30984f2775d7f09e9ed461adc44bb Mon Sep 17 00:00:00 2001 From: Arnaud Hatzenbuhler Date: Sat, 4 Nov 2023 00:41:19 +0100 Subject: [PATCH] [gitlab] Fix gitlab constants calls (#7467) fix: Fix gitlab constants calls Co-authored-by: Arnaud Hatzenbuhler (cherry picked from commit a366318ac683303d05e14d4a7cbac9c7e2fe3077) --- .../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 00000000000..77466f75e6a --- /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 66298e882c2..dd600ea9069 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 90535844310..8c32fc3f770 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 fea374cbfda..89796856f67 100644 --- a/plugins/modules/gitlab_protected_branch.py +++ b/plugins/modules/gitlab_protected_branch.py @@ -94,9 +94,9 @@ def __init__(self, module, project, gitlab_instance): 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 94f37131609..045dc7d7669 100644 --- a/plugins/modules/gitlab_user.py +++ b/plugins/modules/gitlab_user.py @@ -244,12 +244,12 @@ def __init__(self, module, gitlab_instance): 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, } '''