refactor(gitlab modules): remove duplicate gitlab package check (#7486)

This commit is contained in:
Léo GATELLIER 2023-11-11 12:20:12 +01:00 committed by GitHub
parent 6b00b76f32
commit 4a74f46e56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 63 additions and 65 deletions

View file

@ -83,7 +83,7 @@ from ansible.module_utils.api import basic_auth_argument_spec
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
auth_argument_spec, gitlab_authentication, gitlab
)
@ -164,7 +164,9 @@ def main():
],
supports_check_mode=True
)
ensure_gitlab_package(module)
# check prerequisites and connect to gitlab server
gitlab_instance = gitlab_authentication(module)
project = module.params['project']
name = module.params['name']
@ -177,7 +179,6 @@ def main():
module.fail_json(msg="community.general.gitlab_proteched_branch requires python-gitlab Python module >= 2.3.0 (installed version: [%s])."
" Please upgrade python-gitlab to version 2.3.0 or above." % gitlab_version)
gitlab_instance = gitlab_authentication(module)
this_gitlab = GitlabProtectedBranch(module=module, project=project, gitlab_instance=gitlab_instance)
p_branch = this_gitlab.protected_branch_exist(name=name)