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)

* gitlab modules: improved imports

* add changelog fragment

* refactored the import check to its sole function
This commit is contained in:
Alexei Znamensky 2022-09-13 06:30:02 +12:00 committed by GitHub
parent 5470ea30dc
commit 6b463e6fa6
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

@ -14,10 +14,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
@ -27,6 +26,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
@ -64,6 +64,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']
@ -73,8 +81,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

@ -72,20 +72,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):
@ -144,15 +137,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

@ -109,22 +109,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):
@ -262,6 +253,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']
@ -269,9 +261,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

@ -159,21 +159,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):
@ -339,6 +331,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']
@ -352,9 +345,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

@ -152,19 +152,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):
@ -282,9 +274,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

@ -159,21 +159,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):
@ -416,9 +409,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

@ -159,22 +159,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):
@ -330,6 +320,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']
@ -346,9 +337,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

@ -246,21 +246,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):
@ -444,6 +437,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']
@ -474,9 +468,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

@ -155,19 +155,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):
@ -282,9 +274,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

@ -176,7 +176,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
@ -189,7 +188,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):
@ -431,6 +432,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

@ -70,22 +70,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):
@ -165,6 +157,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']
@ -172,9 +165,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

@ -172,21 +172,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
@ -362,6 +355,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']
@ -374,9 +368,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

@ -221,21 +221,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):
@ -616,6 +609,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']
@ -634,9 +628,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)