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