1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

gitlab modules: improved imports (#5259) (#5276)

* gitlab modules: improved imports

* add changelog fragment

* refactored the import check to its sole function

(cherry picked from commit 6b463e6fa6)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-09-12 21:14:02 +02:00 committed by GitHub
parent f798d914e1
commit 5462773827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 85 additions and 170 deletions

View file

@ -0,0 +1,14 @@
minor_changes:
- gitlab module util - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_branch - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_deploy_key - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_group - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_group_members - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_group_variable - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_hook - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_project - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_project_members - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_project_variable - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_protected_branch - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_runner - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).
- gitlab_user - minor refactor when checking for installed dependency (https://github.com/ansible-collections/community.general/pull/5259).

View file

@ -13,10 +13,9 @@ from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
try: try:
from urllib import quote_plus # Python 2.X
from urlparse import urljoin from urlparse import urljoin
except ImportError: except ImportError:
from urllib.parse import quote_plus, urljoin # Python 3+ from urllib.parse import urljoin # Python 3+
import traceback import traceback
@ -26,6 +25,7 @@ try:
import requests import requests
HAS_GITLAB_PACKAGE = True HAS_GITLAB_PACKAGE = True
except Exception: except Exception:
gitlab = None
GITLAB_IMP_ERR = traceback.format_exc() GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False HAS_GITLAB_PACKAGE = False
@ -63,6 +63,14 @@ def find_group(gitlab_instance, identifier):
return project return project
def ensure_gitlab_package(module):
if not HAS_GITLAB_PACKAGE:
module.fail_json(
msg=missing_required_lib("python-gitlab", url='https://python-gitlab.readthedocs.io/en/stable/'),
exception=GITLAB_IMP_ERR
)
def gitlab_authentication(module): def gitlab_authentication(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']
@ -72,8 +80,7 @@ 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']
if not HAS_GITLAB_PACKAGE: ensure_gitlab_package(module)
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
try: try:
# python-gitlab library remove support for username/password authentication since 1.13.0 # python-gitlab library remove support for username/password authentication since 1.13.0

View file

@ -71,20 +71,13 @@ RETURN = '''
import traceback import traceback
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.version import LooseVersion from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.gitlab import (
GITLAB_IMP_ERR = None auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
try: )
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
class GitlabBranch(object): class GitlabBranch(object):
@ -143,15 +136,13 @@ def main():
], ],
supports_check_mode=False supports_check_mode=False
) )
ensure_gitlab_package(module)
project = module.params['project'] project = module.params['project']
branch = module.params['branch'] branch = module.params['branch']
ref_branch = module.params['ref_branch'] ref_branch = module.params['ref_branch']
state = module.params['state'] state = module.params['state']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_version = gitlab.__version__ gitlab_version = gitlab.__version__
if LooseVersion(gitlab_version) < LooseVersion('2.3.0'): if LooseVersion(gitlab_version) < LooseVersion('2.3.0'):
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])."

View file

@ -108,22 +108,13 @@ deploy_key:
type: dict type: dict
''' '''
import re
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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 auth_argument_spec, find_project, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, find_project, gitlab_authentication, gitlab, ensure_gitlab_package
)
class GitLabDeployKey(object): class GitLabDeployKey(object):
@ -261,6 +252,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
state = module.params['state'] state = module.params['state']
project_identifier = module.params['project'] project_identifier = module.params['project']
@ -268,9 +260,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']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_instance = gitlab_authentication(module) gitlab_instance = gitlab_authentication(module)
gitlab_deploy_key = GitLabDeployKey(module, gitlab_instance) gitlab_deploy_key = GitLabDeployKey(module, gitlab_instance)

View file

@ -158,21 +158,13 @@ group:
type: dict type: dict
''' '''
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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 auth_argument_spec, find_group, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, find_group, gitlab_authentication, gitlab, ensure_gitlab_package
)
class GitLabGroup(object): class GitLabGroup(object):
@ -338,6 +330,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
group_name = module.params['name'] group_name = module.params['name']
group_path = module.params['path'] group_path = module.params['path']
@ -351,9 +344,6 @@ def main():
require_two_factor_authentication = module.params['require_two_factor_authentication'] require_two_factor_authentication = module.params['require_two_factor_authentication']
avatar_path = module.params['avatar_path'] avatar_path = module.params['avatar_path']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_instance = gitlab_authentication(module) gitlab_instance = gitlab_authentication(module)
# Define default group_path based on group_name # Define default group_path based on group_name

View file

@ -151,19 +151,11 @@ EXAMPLES = r'''
RETURN = r''' # ''' RETURN = r''' # '''
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
import traceback )
try:
import gitlab
HAS_PY_GITLAB = True
GITLAB_IMP_ERR = None
except ImportError:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_PY_GITLAB = False
class GitLabGroup(object): class GitLabGroup(object):
@ -281,9 +273,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
if not HAS_PY_GITLAB:
module.fail_json(msg=missing_required_lib('python-gitlab', url='https://python-gitlab.readthedocs.io/en/stable/'), exception=GITLAB_IMP_ERR)
access_level_int = { access_level_int = {
'guest': gitlab.GUEST_ACCESS, 'guest': gitlab.GUEST_ACCESS,

View file

@ -158,21 +158,14 @@ group_variable:
sample: "['ACCESS_KEY_ID', 'SECRET_ACCESS_KEY']" sample: "['ACCESS_KEY_ID', 'SECRET_ACCESS_KEY']"
''' '''
import traceback from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.module_utils.six import integer_types from ansible.module_utils.six import integer_types
GITLAB_IMP_ERR = None from ansible_collections.community.general.plugins.module_utils.gitlab import (
try: auth_argument_spec, gitlab_authentication, ensure_gitlab_package
import gitlab )
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
def vars_to_variables(vars, module): def vars_to_variables(vars, module):
@ -415,9 +408,7 @@ def main():
], ],
supports_check_mode=True supports_check_mode=True
) )
ensure_gitlab_package(module)
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
purge = module.params['purge'] purge = module.params['purge']
var_list = module.params['vars'] var_list = module.params['vars']

View file

@ -158,22 +158,12 @@ hook:
type: dict type: dict
''' '''
import re
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, find_project, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, find_project, gitlab_authentication, ensure_gitlab_package
)
class GitLabHook(object): class GitLabHook(object):
@ -329,6 +319,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
state = module.params['state'] state = module.params['state']
project_identifier = module.params['project'] project_identifier = module.params['project']
@ -345,9 +336,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']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_instance = gitlab_authentication(module) gitlab_instance = gitlab_authentication(module)
gitlab_hook = GitLabHook(module, gitlab_instance) gitlab_hook = GitLabHook(module, gitlab_instance)

View file

@ -245,21 +245,14 @@ project:
type: dict type: dict
''' '''
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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 auth_argument_spec, find_group, find_project, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, find_group, find_project, gitlab_authentication, gitlab, ensure_gitlab_package
)
class GitLabProject(object): class GitLabProject(object):
@ -443,6 +436,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
group_identifier = module.params['group'] group_identifier = module.params['group']
project_name = module.params['name'] project_name = module.params['name']
@ -473,9 +467,6 @@ def main():
if default_branch and not initialize_with_readme: if default_branch and not initialize_with_readme:
module.fail_json(msg="Param default_branch need param initialize_with_readme set to true") module.fail_json(msg="Param default_branch need param initialize_with_readme set to true")
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_instance = gitlab_authentication(module) 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.

View file

@ -154,19 +154,11 @@ EXAMPLES = r'''
RETURN = r''' # ''' RETURN = r''' # '''
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
import traceback )
try:
import gitlab
HAS_PY_GITLAB = True
GITLAB_IMP_ERR = None
except ImportError:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_PY_GITLAB = False
class GitLabProjectMembers(object): class GitLabProjectMembers(object):
@ -281,9 +273,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
if not HAS_PY_GITLAB:
module.fail_json(msg=missing_required_lib('python-gitlab', url='https://python-gitlab.readthedocs.io/en/stable/'), exception=GITLAB_IMP_ERR)
access_level_int = { access_level_int = {
'guest': gitlab.GUEST_ACCESS, 'guest': gitlab.GUEST_ACCESS,

View file

@ -175,7 +175,6 @@ project_variable:
import traceback import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.module_utils.six import integer_types from ansible.module_utils.six import integer_types
@ -188,7 +187,9 @@ except Exception:
GITLAB_IMP_ERR = traceback.format_exc() GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False HAS_GITLAB_PACKAGE = False
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, ensure_gitlab_package
)
def vars_to_variables(vars, module): def vars_to_variables(vars, module):
@ -430,6 +431,7 @@ def main():
], ],
supports_check_mode=True supports_check_mode=True
) )
ensure_gitlab_package(module)
if not HAS_GITLAB_PACKAGE: if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR) module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)

View file

@ -69,22 +69,14 @@ EXAMPLES = '''
RETURN = ''' RETURN = '''
''' '''
import traceback from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
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.version import LooseVersion from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
GITLAB_IMP_ERR = None from ansible_collections.community.general.plugins.module_utils.gitlab import (
try: auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
import gitlab )
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible_collections.community.general.plugins.module_utils.gitlab import auth_argument_spec, gitlab_authentication
class GitlabProtectedBranch(object): class GitlabProtectedBranch(object):
@ -164,6 +156,7 @@ def main():
], ],
supports_check_mode=True supports_check_mode=True
) )
ensure_gitlab_package(module)
project = module.params['project'] project = module.params['project']
name = module.params['name'] name = module.params['name']
@ -171,9 +164,6 @@ def main():
push_access_level = module.params['push_access_level'] push_access_level = module.params['push_access_level']
state = module.params['state'] state = module.params['state']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_version = gitlab.__version__ gitlab_version = gitlab.__version__
if LooseVersion(gitlab_version) < LooseVersion('2.3.0'): if LooseVersion(gitlab_version) < LooseVersion('2.3.0'):
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])."

View file

@ -171,21 +171,14 @@ runner:
type: dict type: dict
''' '''
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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 auth_argument_spec, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, gitlab_authentication, gitlab, ensure_gitlab_package
)
try: try:
cmp # pylint: disable=used-before-assignment cmp # pylint: disable=used-before-assignment
@ -361,6 +354,7 @@ def main():
], ],
supports_check_mode=True, supports_check_mode=True,
) )
ensure_gitlab_package(module)
state = module.params['state'] state = module.params['state']
runner_description = module.params['description'] runner_description = module.params['description']
@ -373,9 +367,6 @@ def main():
registration_token = module.params['registration_token'] registration_token = module.params['registration_token']
project = module.params['project'] project = module.params['project']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_instance = gitlab_authentication(module) gitlab_instance = gitlab_authentication(module)
gitlab_project = None gitlab_project = None
if project: if project:

View file

@ -220,21 +220,14 @@ user:
type: dict type: dict
''' '''
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except Exception:
GITLAB_IMP_ERR = traceback.format_exc()
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.api import basic_auth_argument_spec from ansible.module_utils.api import basic_auth_argument_spec
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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 auth_argument_spec, find_group, gitlab_authentication from ansible_collections.community.general.plugins.module_utils.gitlab import (
auth_argument_spec, find_group, gitlab_authentication, gitlab, ensure_gitlab_package
)
class GitLabUser(object): class GitLabUser(object):
@ -615,6 +608,7 @@ def main():
('state', 'present', ['name', 'email']), ('state', 'present', ['name', 'email']),
) )
) )
ensure_gitlab_package(module)
user_name = module.params['name'] user_name = module.params['name']
state = module.params['state'] state = module.params['state']
@ -633,9 +627,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']
if not HAS_GITLAB_PACKAGE:
module.fail_json(msg=missing_required_lib("python-gitlab"), exception=GITLAB_IMP_ERR)
gitlab_instance = gitlab_authentication(module) gitlab_instance = gitlab_authentication(module)
gitlab_user = GitLabUser(module, gitlab_instance) gitlab_user = GitLabUser(module, gitlab_instance)