|
|
|
@ -30,24 +30,10 @@ requirements:
|
|
|
|
|
extends_documentation_fragment:
|
|
|
|
|
- auth_basic
|
|
|
|
|
options:
|
|
|
|
|
server_url:
|
|
|
|
|
description:
|
|
|
|
|
- The URL of the GitLab server, with protocol (i.e. http or https).
|
|
|
|
|
type: str
|
|
|
|
|
login_user:
|
|
|
|
|
description:
|
|
|
|
|
- GitLab user name.
|
|
|
|
|
type: str
|
|
|
|
|
login_password:
|
|
|
|
|
description:
|
|
|
|
|
- GitLab password for login_user
|
|
|
|
|
type: str
|
|
|
|
|
api_token:
|
|
|
|
|
description:
|
|
|
|
|
- GitLab token for logging in.
|
|
|
|
|
type: str
|
|
|
|
|
aliases:
|
|
|
|
|
- login_token
|
|
|
|
|
group:
|
|
|
|
|
description:
|
|
|
|
|
- Id or The full path of the group of which this projects belongs to.
|
|
|
|
@ -59,7 +45,7 @@ options:
|
|
|
|
|
type: str
|
|
|
|
|
path:
|
|
|
|
|
description:
|
|
|
|
|
- The path of the project you want to create, this will be server_url/<group>/path
|
|
|
|
|
- The path of the project you want to create, this will be server_url/<group>/path.
|
|
|
|
|
- If not supplied, name will be used.
|
|
|
|
|
type: str
|
|
|
|
|
description:
|
|
|
|
@ -165,7 +151,6 @@ project:
|
|
|
|
|
type: dict
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import traceback
|
|
|
|
|
|
|
|
|
|
GITLAB_IMP_ERR = None
|
|
|
|
@ -235,7 +220,7 @@ class GitLabProject(object):
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
@param namespace Namespace Object (User or Group)
|
|
|
|
|
@param arguments Attributs of the project
|
|
|
|
|
@param arguments Attributes of the project
|
|
|
|
|
'''
|
|
|
|
|
def createProject(self, namespace, arguments):
|
|
|
|
|
if self._module.check_mode:
|
|
|
|
@ -251,7 +236,7 @@ class GitLabProject(object):
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
@param project Project Object
|
|
|
|
|
@param arguments Attributs of the project
|
|
|
|
|
@param arguments Attributes of the project
|
|
|
|
|
'''
|
|
|
|
|
def updateProject(self, project, arguments):
|
|
|
|
|
changed = False
|
|
|
|
@ -285,21 +270,10 @@ class GitLabProject(object):
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def deprecation_warning(module):
|
|
|
|
|
deprecated_aliases = ['login_token']
|
|
|
|
|
|
|
|
|
|
for aliase in deprecated_aliases:
|
|
|
|
|
if aliase in module.params:
|
|
|
|
|
module.deprecate("Alias \'{aliase}\' is deprecated".format(aliase=aliase), "2.10")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
argument_spec = basic_auth_argument_spec()
|
|
|
|
|
argument_spec.update(dict(
|
|
|
|
|
server_url=dict(type='str', removed_in_version="2.10"),
|
|
|
|
|
login_user=dict(type='str', no_log=True, removed_in_version="2.10"),
|
|
|
|
|
login_password=dict(type='str', no_log=True, removed_in_version="2.10"),
|
|
|
|
|
api_token=dict(type='str', no_log=True, aliases=["login_token"]),
|
|
|
|
|
api_token=dict(type='str', no_log=True),
|
|
|
|
|
group=dict(type='str'),
|
|
|
|
|
name=dict(type='str', required=True),
|
|
|
|
|
path=dict(type='str'),
|
|
|
|
@ -316,39 +290,22 @@ def main():
|
|
|
|
|
module = AnsibleModule(
|
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
|
mutually_exclusive=[
|
|
|
|
|
['api_url', 'server_url'],
|
|
|
|
|
['api_username', 'login_user'],
|
|
|
|
|
['api_password', 'login_password'],
|
|
|
|
|
['api_username', 'api_token'],
|
|
|
|
|
['api_password', 'api_token'],
|
|
|
|
|
['login_user', 'login_token'],
|
|
|
|
|
['login_password', 'login_token']
|
|
|
|
|
],
|
|
|
|
|
required_together=[
|
|
|
|
|
['api_username', 'api_password'],
|
|
|
|
|
['login_user', 'login_password'],
|
|
|
|
|
],
|
|
|
|
|
required_one_of=[
|
|
|
|
|
['api_username', 'api_token', 'login_user', 'login_token'],
|
|
|
|
|
['server_url', 'api_url']
|
|
|
|
|
['api_username', 'api_token']
|
|
|
|
|
],
|
|
|
|
|
supports_check_mode=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
deprecation_warning(module)
|
|
|
|
|
|
|
|
|
|
server_url = module.params['server_url']
|
|
|
|
|
login_user = module.params['login_user']
|
|
|
|
|
login_password = module.params['login_password']
|
|
|
|
|
|
|
|
|
|
api_url = module.params['api_url']
|
|
|
|
|
gitlab_url = module.params['api_url']
|
|
|
|
|
validate_certs = module.params['validate_certs']
|
|
|
|
|
api_user = module.params['api_username']
|
|
|
|
|
api_password = module.params['api_password']
|
|
|
|
|
|
|
|
|
|
gitlab_url = server_url if api_url is None else api_url
|
|
|
|
|
gitlab_user = login_user if api_user is None else api_user
|
|
|
|
|
gitlab_password = login_password if api_password is None else api_password
|
|
|
|
|
gitlab_user = module.params['api_username']
|
|
|
|
|
gitlab_password = module.params['api_password']
|
|
|
|
|
gitlab_token = module.params['api_token']
|
|
|
|
|
|
|
|
|
|
group_identifier = module.params['group']
|
|
|
|
|