mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
refactor(gitlab modules): remove duplicate gitlab package check (#7486)
This commit is contained in:
parent
6b00b76f32
commit
4a74f46e56
17 changed files with 63 additions and 65 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- gitlab modules - remove duplicate ``gitlab`` package check (https://github.com/ansible-collections/community.general/pull/7486).
|
|
@ -75,6 +75,8 @@ def ensure_gitlab_package(module):
|
||||||
|
|
||||||
|
|
||||||
def gitlab_authentication(module):
|
def gitlab_authentication(module):
|
||||||
|
ensure_gitlab_package(module)
|
||||||
|
|
||||||
gitlab_url = module.params['api_url']
|
gitlab_url = module.params['api_url']
|
||||||
validate_certs = module.params['validate_certs']
|
validate_certs = module.params['validate_certs']
|
||||||
ca_path = module.params['ca_path']
|
ca_path = module.params['ca_path']
|
||||||
|
@ -84,8 +86,6 @@ def gitlab_authentication(module):
|
||||||
gitlab_oauth_token = module.params['api_oauth_token']
|
gitlab_oauth_token = module.params['api_oauth_token']
|
||||||
gitlab_job_token = module.params['api_job_token']
|
gitlab_job_token = module.params['api_job_token']
|
||||||
|
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
|
||||||
verify = ca_path if validate_certs and ca_path else validate_certs
|
verify = ca_path if validate_certs and ca_path else validate_certs
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -84,7 +84,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.version import LooseVersion
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +144,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=False
|
supports_check_mode=False
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
project = module.params['project']
|
project = module.params['project']
|
||||||
branch = module.params['branch']
|
branch = module.params['branch']
|
||||||
|
@ -156,7 +158,6 @@ def main():
|
||||||
module.fail_json(msg="community.general.gitlab_proteched_branch requires python-gitlab Python module >= 2.3.0 (installed version: [%s])."
|
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)
|
" Please upgrade python-gitlab to version 2.3.0 or above." % gitlab_version)
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
this_gitlab = GitlabBranch(module=module, project=project, gitlab_instance=gitlab_instance)
|
this_gitlab = GitlabBranch(module=module, project=project, gitlab_instance=gitlab_instance)
|
||||||
|
|
||||||
this_branch = this_gitlab.get_branch(branch)
|
this_branch = this_gitlab.get_branch(branch)
|
||||||
|
|
|
@ -121,7 +121,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, find_project, gitlab_authentication, gitlab, ensure_gitlab_package
|
auth_argument_spec, find_project, gitlab_authentication, gitlab
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +261,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
project_identifier = module.params['project']
|
project_identifier = module.params['project']
|
||||||
|
@ -269,8 +271,6 @@ def main():
|
||||||
key_keyfile = module.params['key']
|
key_keyfile = module.params['key']
|
||||||
key_can_push = module.params['can_push']
|
key_can_push = module.params['can_push']
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
gitlab_deploy_key = GitLabDeployKey(module, gitlab_instance)
|
gitlab_deploy_key = GitLabDeployKey(module, gitlab_instance)
|
||||||
|
|
||||||
project = find_project(gitlab_instance, project_identifier)
|
project = find_project(gitlab_instance, project_identifier)
|
||||||
|
|
|
@ -178,7 +178,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, find_group, gitlab_authentication, gitlab, ensure_gitlab_package
|
auth_argument_spec, find_group, gitlab_authentication, gitlab
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -355,7 +355,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
group_name = module.params['name']
|
group_name = module.params['name']
|
||||||
group_path = module.params['path']
|
group_path = module.params['path']
|
||||||
|
@ -370,8 +372,6 @@ def main():
|
||||||
avatar_path = module.params['avatar_path']
|
avatar_path = module.params['avatar_path']
|
||||||
force_delete = module.params['force_delete']
|
force_delete = module.params['force_delete']
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
# Define default group_path based on group_name
|
# Define default group_path based on group_name
|
||||||
if group_path is None:
|
if group_path is None:
|
||||||
group_path = group_name.replace(" ", "_")
|
group_path = group_name.replace(" ", "_")
|
||||||
|
|
|
@ -160,7 +160,7 @@ from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -273,7 +273,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gl = gitlab_authentication(module)
|
||||||
|
|
||||||
access_level_int = {
|
access_level_int = {
|
||||||
'guest': gitlab.const.GUEST_ACCESS,
|
'guest': gitlab.const.GUEST_ACCESS,
|
||||||
|
@ -291,9 +293,6 @@ def main():
|
||||||
if purge_users:
|
if purge_users:
|
||||||
purge_users = [access_level_int[level] for level in purge_users]
|
purge_users = [access_level_int[level] for level in purge_users]
|
||||||
|
|
||||||
# connect to gitlab server
|
|
||||||
gl = gitlab_authentication(module)
|
|
||||||
|
|
||||||
group = GitLabGroup(module, gl)
|
group = GitLabGroup(module, gl)
|
||||||
|
|
||||||
gitlab_group_id = group.get_group_id(gitlab_group)
|
gitlab_group_id = group.get_group_id(gitlab_group)
|
||||||
|
|
|
@ -207,7 +207,7 @@ group_variable:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.api import basic_auth_argument_spec
|
from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, gitlab_authentication, ensure_gitlab_package, filter_returned_variables, vars_to_variables
|
auth_argument_spec, gitlab_authentication, filter_returned_variables, vars_to_variables
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -413,7 +413,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
purge = module.params['purge']
|
purge = module.params['purge']
|
||||||
var_list = module.params['vars']
|
var_list = module.params['vars']
|
||||||
|
@ -428,8 +430,6 @@ def main():
|
||||||
if any(x['value'] is None for x in variables):
|
if any(x['value'] is None for x in variables):
|
||||||
module.fail_json(msg='value parameter is required in state present')
|
module.fail_json(msg='value parameter is required in state present')
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
this_gitlab = GitlabGroupVariables(module=module, gitlab_instance=gitlab_instance)
|
this_gitlab = GitlabGroupVariables(module=module, gitlab_instance=gitlab_instance)
|
||||||
|
|
||||||
changed, raw_return_value, before, after = native_python_main(this_gitlab, purge, variables, state, module)
|
changed, raw_return_value, before, after = native_python_main(this_gitlab, purge, variables, state, module)
|
||||||
|
|
|
@ -171,7 +171,7 @@ from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, find_project, gitlab_authentication, ensure_gitlab_package
|
auth_argument_spec, find_project, gitlab_authentication
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,7 +325,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
project_identifier = module.params['project']
|
project_identifier = module.params['project']
|
||||||
|
@ -342,8 +344,6 @@ def main():
|
||||||
enable_ssl_verification = module.params['hook_validate_certs']
|
enable_ssl_verification = module.params['hook_validate_certs']
|
||||||
hook_token = module.params['token']
|
hook_token = module.params['token']
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
gitlab_hook = GitLabHook(module, gitlab_instance)
|
gitlab_hook = GitLabHook(module, gitlab_instance)
|
||||||
|
|
||||||
project = find_project(gitlab_instance, project_identifier)
|
project = find_project(gitlab_instance, project_identifier)
|
||||||
|
|
|
@ -139,7 +139,7 @@ instance_variable:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.api import basic_auth_argument_spec
|
from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, gitlab_authentication, ensure_gitlab_package, filter_returned_variables
|
auth_argument_spec, gitlab_authentication, filter_returned_variables
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,7 +326,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
purge = module.params['purge']
|
purge = module.params['purge']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
@ -337,8 +339,6 @@ def main():
|
||||||
if any(x['value'] is None for x in variables):
|
if any(x['value'] is None for x in variables):
|
||||||
module.fail_json(msg='value parameter is required in state present')
|
module.fail_json(msg='value parameter is required in state present')
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
this_gitlab = GitlabInstanceVariables(module=module, gitlab_instance=gitlab_instance)
|
this_gitlab = GitlabInstanceVariables(module=module, gitlab_instance=gitlab_instance)
|
||||||
|
|
||||||
changed, raw_return_value, before, after = native_python_main(this_gitlab, purge, variables, state, module)
|
changed, raw_return_value, before, after = native_python_main(this_gitlab, purge, variables, state, module)
|
||||||
|
|
|
@ -152,7 +152,7 @@ from ansible.module_utils.common.text.converters import to_native, to_text
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package, find_project
|
auth_argument_spec, gitlab_authentication, gitlab, find_project
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,7 +321,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
project = module.params['project']
|
project = module.params['project']
|
||||||
source_branch = module.params['source_branch']
|
source_branch = module.params['source_branch']
|
||||||
|
@ -341,8 +343,6 @@ def main():
|
||||||
module.fail_json(msg="community.general.gitlab_merge_request requires python-gitlab Python module >= 2.3.0 (installed version: [%s])."
|
module.fail_json(msg="community.general.gitlab_merge_request requires python-gitlab Python module >= 2.3.0 (installed version: [%s])."
|
||||||
" Please upgrade python-gitlab to version 2.3.0 or above." % gitlab_version)
|
" Please upgrade python-gitlab to version 2.3.0 or above." % gitlab_version)
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
this_project = find_project(gitlab_instance, project)
|
this_project = find_project(gitlab_instance, project)
|
||||||
if this_project is None:
|
if this_project is None:
|
||||||
module.fail_json(msg="Failed to get the project: %s" % project)
|
module.fail_json(msg="Failed to get the project: %s" % project)
|
||||||
|
|
|
@ -340,7 +340,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, find_group, find_project, gitlab_authentication, gitlab, ensure_gitlab_package
|
auth_argument_spec, find_group, find_project, gitlab_authentication, gitlab
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
|
@ -558,7 +558,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
group_identifier = module.params['group']
|
group_identifier = module.params['group']
|
||||||
project_name = module.params['name']
|
project_name = module.params['name']
|
||||||
|
@ -596,8 +598,6 @@ def main():
|
||||||
security_and_compliance_access_level = module.params['security_and_compliance_access_level']
|
security_and_compliance_access_level = module.params['security_and_compliance_access_level']
|
||||||
topics = module.params['topics']
|
topics = module.params['topics']
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
# Set project_path to project_name if it is empty.
|
# Set project_path to project_name if it is empty.
|
||||||
if project_path is None:
|
if project_path is None:
|
||||||
project_path = project_name.replace(" ", "_")
|
project_path = project_name.replace(" ", "_")
|
||||||
|
|
|
@ -97,7 +97,7 @@ from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, gitlab_authentication, find_project, ensure_gitlab_package
|
auth_argument_spec, gitlab_authentication, find_project
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,13 +159,12 @@ state_strategy = {
|
||||||
|
|
||||||
|
|
||||||
def core(module):
|
def core(module):
|
||||||
ensure_gitlab_package(module)
|
# check prerequisites and connect to gitlab server
|
||||||
|
gl = gitlab_authentication(module)
|
||||||
|
|
||||||
gitlab_project = module.params['project']
|
gitlab_project = module.params['project']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
gl = gitlab_authentication(module)
|
|
||||||
|
|
||||||
project = find_project(gl, gitlab_project)
|
project = find_project(gl, gitlab_project)
|
||||||
# project doesn't exist
|
# project doesn't exist
|
||||||
if not project:
|
if not project:
|
||||||
|
|
|
@ -163,7 +163,7 @@ from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,7 +279,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gl = gitlab_authentication(module)
|
||||||
|
|
||||||
access_level_int = {
|
access_level_int = {
|
||||||
'guest': gitlab.const.GUEST_ACCESS,
|
'guest': gitlab.const.GUEST_ACCESS,
|
||||||
|
@ -296,9 +298,6 @@ def main():
|
||||||
if purge_users:
|
if purge_users:
|
||||||
purge_users = [access_level_int[level] for level in purge_users]
|
purge_users = [access_level_int[level] for level in purge_users]
|
||||||
|
|
||||||
# connect to gitlab server
|
|
||||||
gl = gitlab_authentication(module)
|
|
||||||
|
|
||||||
project = GitLabProjectMembers(module, gl)
|
project = GitLabProjectMembers(module, gl)
|
||||||
|
|
||||||
gitlab_project_id = project.get_project(gitlab_project)
|
gitlab_project_id = project.get_project(gitlab_project)
|
||||||
|
|
|
@ -221,13 +221,12 @@ project_variable:
|
||||||
sample: ['ACCESS_KEY_ID', 'SECRET_ACCESS_KEY']
|
sample: ['ACCESS_KEY_ID', 'SECRET_ACCESS_KEY']
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.api import basic_auth_argument_spec
|
from ansible.module_utils.api import basic_auth_argument_spec
|
||||||
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, gitlab_authentication, ensure_gitlab_package, filter_returned_variables, vars_to_variables,
|
auth_argument_spec, gitlab_authentication, filter_returned_variables, vars_to_variables
|
||||||
HAS_GITLAB_PACKAGE, GITLAB_IMP_ERR
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -436,10 +435,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
|
||||||
if not HAS_GITLAB_PACKAGE:
|
# check prerequisites and connect to gitlab server
|
||||||
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
purge = module.params['purge']
|
purge = module.params['purge']
|
||||||
var_list = module.params['vars']
|
var_list = module.params['vars']
|
||||||
|
@ -454,8 +452,6 @@ def main():
|
||||||
if any(x['value'] is None for x in variables):
|
if any(x['value'] is None for x in variables):
|
||||||
module.fail_json(msg='value parameter is required for all variables in state present')
|
module.fail_json(msg='value parameter is required for all variables in state present')
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
this_gitlab = GitlabProjectVariables(module=module, gitlab_instance=gitlab_instance)
|
this_gitlab = GitlabProjectVariables(module=module, gitlab_instance=gitlab_instance)
|
||||||
|
|
||||||
change, raw_return_value, before, after = native_python_main(this_gitlab, purge, variables, state, module)
|
change, raw_return_value, before, after = native_python_main(this_gitlab, purge, variables, state, module)
|
||||||
|
|
|
@ -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.version import LooseVersion
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
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
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
project = module.params['project']
|
project = module.params['project']
|
||||||
name = module.params['name']
|
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])."
|
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)
|
" 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)
|
this_gitlab = GitlabProtectedBranch(module=module, project=project, gitlab_instance=gitlab_instance)
|
||||||
|
|
||||||
p_branch = this_gitlab.protected_branch_exist(name=name)
|
p_branch = this_gitlab.protected_branch_exist(name=name)
|
||||||
|
|
|
@ -220,7 +220,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,7 +417,9 @@ def main():
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
runner_description = module.params['description']
|
runner_description = module.params['description']
|
||||||
|
@ -431,7 +433,6 @@ def main():
|
||||||
project = module.params['project']
|
project = module.params['project']
|
||||||
group = module.params['group']
|
group = module.params['group']
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
gitlab_project = None
|
gitlab_project = None
|
||||||
gitlab_group = None
|
gitlab_group = None
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
from ansible.module_utils.common.text.converters import to_native
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
from ansible_collections.community.general.plugins.module_utils.gitlab import (
|
||||||
auth_argument_spec, find_group, gitlab_authentication, gitlab, ensure_gitlab_package
|
auth_argument_spec, find_group, gitlab_authentication, gitlab
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -616,7 +616,9 @@ def main():
|
||||||
('state', 'present', ['name', 'email']),
|
('state', 'present', ['name', 'email']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
ensure_gitlab_package(module)
|
|
||||||
|
# check prerequisites and connect to gitlab server
|
||||||
|
gitlab_instance = gitlab_authentication(module)
|
||||||
|
|
||||||
user_name = module.params['name']
|
user_name = module.params['name']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
@ -635,8 +637,6 @@ def main():
|
||||||
user_identities = module.params['identities']
|
user_identities = module.params['identities']
|
||||||
overwrite_identities = module.params['overwrite_identities']
|
overwrite_identities = module.params['overwrite_identities']
|
||||||
|
|
||||||
gitlab_instance = gitlab_authentication(module)
|
|
||||||
|
|
||||||
gitlab_user = GitLabUser(module, gitlab_instance)
|
gitlab_user = GitLabUser(module, gitlab_instance)
|
||||||
user_exists = gitlab_user.exists_user(user_username)
|
user_exists = gitlab_user.exists_user(user_username)
|
||||||
if user_exists:
|
if user_exists:
|
||||||
|
|
Loading…
Reference in a new issue