gitlab_*: remove deprecated functionalities (#61912)

* Documentation update
* Remove deprecated functionalities

Fixes: #61898 #61897 #61896 #61895 #61894 #61893

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/63725/head
Abhijeet Kasurde 5 years ago committed by ansibot
parent 331d51fb16
commit f92c99b413

@ -34,17 +34,14 @@ options:
- GitLab token for logging in. - GitLab token for logging in.
version_added: "2.8" version_added: "2.8"
type: str type: str
aliases:
- private_token
- access_token
project: project:
description: description:
- Id or Full path of project in the form of group/name - Id or Full path of project in the form of group/name.
required: true required: true
type: str type: str
title: title:
description: description:
- Deploy key's title - Deploy key's title.
required: true required: true
type: str type: str
key: key:
@ -54,13 +51,13 @@ options:
type: str type: str
can_push: can_push:
description: description:
- Whether this key can push to the project - Whether this key can push to the project.
type: bool type: bool
default: no default: no
state: state:
description: description:
- When C(present) the deploy key added to the project if it doesn't exist. - When C(present) the deploy key added to the project if it doesn't exist.
- When C(absent) it will be removed from the project if it exists - When C(absent) it will be removed from the project if it exists.
required: true required: true
default: present default: present
type: str type: str
@ -71,7 +68,7 @@ EXAMPLES = '''
- name: "Adding a project deploy key" - name: "Adding a project deploy key"
gitlab_deploy_key: gitlab_deploy_key:
api_url: https://gitlab.example.com/ api_url: https://gitlab.example.com/
api_token: "{{ access_token }}" api_token: "{{ api_token }}"
project: "my_group/my_project" project: "my_group/my_project"
title: "Jenkins CI" title: "Jenkins CI"
state: present state: present
@ -80,7 +77,7 @@ EXAMPLES = '''
- name: "Update the above deploy key to add push access" - name: "Update the above deploy key to add push access"
gitlab_deploy_key: gitlab_deploy_key:
api_url: https://gitlab.example.com/ api_url: https://gitlab.example.com/
api_token: "{{ access_token }}" api_token: "{{ api_token }}"
project: "my_group/my_project" project: "my_group/my_project"
title: "Jenkins CI" title: "Jenkins CI"
state: present state: present
@ -89,7 +86,7 @@ EXAMPLES = '''
- name: "Remove the previous deploy key from the project" - name: "Remove the previous deploy key from the project"
gitlab_deploy_key: gitlab_deploy_key:
api_url: https://gitlab.example.com/ api_url: https://gitlab.example.com/
api_token: "{{ access_token }}" api_token: "{{ api_token }}"
project: "my_group/my_project" project: "my_group/my_project"
state: absent state: absent
key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..." key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..."
@ -120,7 +117,6 @@ deploy_key:
type: dict type: dict
''' '''
import os
import re import re
import traceback import traceback
@ -181,7 +177,7 @@ class GitLabDeployKey(object):
''' '''
@param project Project Object @param project Project Object
@param arguments Attributs of the deployKey @param arguments Attributes of the deployKey
''' '''
def createDeployKey(self, project, arguments): def createDeployKey(self, project, arguments):
if self._module.check_mode: if self._module.check_mode:
@ -196,7 +192,7 @@ class GitLabDeployKey(object):
''' '''
@param deployKey Deploy Key Object @param deployKey Deploy Key Object
@param arguments Attributs of the deployKey @param arguments Attributes of the deployKey
''' '''
def updateDeployKey(self, deployKey, arguments): def updateDeployKey(self, deployKey, arguments):
changed = False changed = False
@ -238,18 +234,10 @@ class GitLabDeployKey(object):
return self.deployKeyObject.delete() return self.deployKeyObject.delete()
def deprecation_warning(module):
deprecated_aliases = ['private_token', 'access_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(
api_token=dict(type='str', no_log=True, aliases=["private_token", "access_token"]), api_token=dict(type='str', no_log=True),
state=dict(type='str', default="present", choices=["absent", "present"]), state=dict(type='str', default="present", choices=["absent", "present"]),
project=dict(type='str', required=True), project=dict(type='str', required=True),
key=dict(type='str', required=True), key=dict(type='str', required=True),
@ -272,8 +260,6 @@ def main():
supports_check_mode=True, supports_check_mode=True,
) )
deprecation_warning(module)
gitlab_url = re.sub('/api.*', '', module.params['api_url']) gitlab_url = re.sub('/api.*', '', module.params['api_url'])
validate_certs = module.params['validate_certs'] validate_certs = module.params['validate_certs']
gitlab_user = module.params['api_username'] gitlab_user = module.params['api_username']

@ -29,24 +29,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
name: name:
description: description:
- Name of the group you want to create. - Name of the group you want to create.
@ -54,7 +40,7 @@ options:
type: str type: str
path: path:
description: description:
- The path of the group you want to create, this will be server_url/group_path - The path of the group you want to create, this will be api_url/group_path
- If not supplied, the group_name will be used. - If not supplied, the group_name will be used.
type: str type: str
description: description:
@ -140,7 +126,6 @@ group:
type: dict type: dict
''' '''
import os
import traceback import traceback
GITLAB_IMP_ERR = None GITLAB_IMP_ERR = None
@ -210,7 +195,7 @@ class GitLabGroup(object):
return False return False
''' '''
@param arguments Attributs of the group @param arguments Attributes of the group
''' '''
def createGroup(self, arguments): def createGroup(self, arguments):
if self._module.check_mode: if self._module.check_mode:
@ -225,7 +210,7 @@ class GitLabGroup(object):
''' '''
@param group Group Object @param group Group Object
@param arguments Attributs of the group @param arguments Attributes of the group
''' '''
def updateGroup(self, group, arguments): def updateGroup(self, group, arguments):
changed = False changed = False
@ -266,21 +251,10 @@ class GitLabGroup(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"]),
name=dict(type='str', required=True), name=dict(type='str', required=True),
path=dict(type='str'), path=dict(type='str'),
description=dict(type='str'), description=dict(type='str'),
@ -292,39 +266,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)
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_url = module.params['api_url']
api_password = module.params['api_password'] gitlab_user = module.params['api_username']
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_name = module.params['name'] group_name = module.params['name']

@ -35,9 +35,6 @@ options:
- GitLab token for logging in. - GitLab token for logging in.
version_added: "2.8" version_added: "2.8"
type: str type: str
aliases:
- private_token
- access_token
project: project:
description: description:
- Id or Full path of the project in the form of group/name. - Id or Full path of the project in the form of group/name.
@ -165,7 +162,6 @@ hook:
type: dict type: dict
''' '''
import os
import re import re
import traceback import traceback
@ -242,7 +238,7 @@ class GitLabHook(object):
''' '''
@param project Project Object @param project Project Object
@param arguments Attributs of the hook @param arguments Attributes of the hook
''' '''
def createHook(self, project, arguments): def createHook(self, project, arguments):
if self._module.check_mode: if self._module.check_mode:
@ -254,7 +250,7 @@ class GitLabHook(object):
''' '''
@param hook Hook Object @param hook Hook Object
@param arguments Attributs of the hook @param arguments Attributes of the hook
''' '''
def updateHook(self, hook, arguments): def updateHook(self, hook, arguments):
changed = False changed = False
@ -296,18 +292,10 @@ class GitLabHook(object):
return self.hookObject.delete() return self.hookObject.delete()
def deprecation_warning(module):
deprecated_aliases = ['private_token', 'access_token', 'enable_ssl_verification']
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(
api_token=dict(type='str', no_log=True, aliases=["private_token", "access_token"]), api_token=dict(type='str', no_log=True),
state=dict(type='str', default="present", choices=["absent", "present"]), state=dict(type='str', default="present", choices=["absent", "present"]),
project=dict(type='str', required=True), project=dict(type='str', required=True),
hook_url=dict(type='str', required=True), hook_url=dict(type='str', required=True),
@ -338,8 +326,6 @@ def main():
supports_check_mode=True, supports_check_mode=True,
) )
deprecation_warning(module)
gitlab_url = re.sub('/api.*', '', module.params['api_url']) gitlab_url = re.sub('/api.*', '', module.params['api_url'])
validate_certs = module.params['validate_certs'] validate_certs = module.params['validate_certs']
gitlab_user = module.params['api_username'] gitlab_user = module.params['api_username']

@ -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']

@ -26,7 +26,7 @@ description:
To create shared runners, you need to ask your administrator to give you this token. To create shared runners, you need to ask your administrator to give you this token.
It can be found at U(https://$GITLAB_URL/admin/runners/). It can be found at U(https://$GITLAB_URL/admin/runners/).
notes: notes:
- To create a new runner at least the C(api_token), C(description) and C(url) options are required. - To create a new runner at least the C(api_token), C(description) and C(api_url) options are required.
- Runners need to have unique descriptions. - Runners need to have unique descriptions.
version_added: 2.8 version_added: 2.8
author: author:
@ -38,17 +38,11 @@ requirements:
extends_documentation_fragment: extends_documentation_fragment:
- auth_basic - auth_basic
options: options:
url:
description:
- The URL of the GitLab server, with protocol (i.e. http or https).
type: str
api_token: api_token:
description: description:
- Your private token to interact with the GitLab API. - Your private token to interact with the GitLab API.
required: True required: True
type: str type: str
aliases:
- private_token
description: description:
description: description:
- The unique name of the runner. - The unique name of the runner.
@ -151,8 +145,6 @@ runner:
type: dict type: dict
''' '''
import os
import re
import traceback import traceback
GITLAB_IMP_ERR = None GITLAB_IMP_ERR = None
@ -217,7 +209,7 @@ class GitLabRunner(object):
return False return False
''' '''
@param arguments Attributs of the runner @param arguments Attributes of the runner
''' '''
def createRunner(self, arguments): def createRunner(self, arguments):
if self._module.check_mode: if self._module.check_mode:
@ -232,7 +224,7 @@ class GitLabRunner(object):
''' '''
@param runner Runner object @param runner Runner object
@param arguments Attributs of the runner @param arguments Attributes of the runner
''' '''
def updateRunner(self, runner, arguments): def updateRunner(self, runner, arguments):
changed = False changed = False
@ -284,19 +276,10 @@ class GitLabRunner(object):
return runner.delete() return runner.delete()
def deprecation_warning(module):
deprecated_aliases = ['private_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(
url=dict(type='str', removed_in_version="2.10"), api_token=dict(type='str', no_log=True),
api_token=dict(type='str', no_log=True, aliases=["private_token"]),
description=dict(type='str', required=True, aliases=["name"]), description=dict(type='str', required=True, aliases=["name"]),
active=dict(type='bool', default=True), active=dict(type='bool', default=True),
tag_list=dict(type='list', default=[]), tag_list=dict(type='list', default=[]),
@ -311,30 +294,20 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=argument_spec, argument_spec=argument_spec,
mutually_exclusive=[ mutually_exclusive=[
['api_url', 'url'],
['api_username', 'api_token'], ['api_username', 'api_token'],
['api_password', 'api_token'], ['api_password', 'api_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'], ['api_username', 'api_token'],
['api_url', 'url']
], ],
supports_check_mode=True, supports_check_mode=True,
) )
deprecation_warning(module) gitlab_url = module.params['api_url']
if module.params['url'] is not None:
url = re.sub('/api.*', '', module.params['url'])
api_url = module.params['api_url']
validate_certs = module.params['validate_certs'] validate_certs = module.params['validate_certs']
gitlab_url = url if api_url is None else api_url
gitlab_user = module.params['api_username'] gitlab_user = module.params['api_username']
gitlab_password = module.params['api_password'] gitlab_password = module.params['api_password']
gitlab_token = module.params['api_token'] gitlab_token = module.params['api_token']

@ -31,24 +31,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
name: name:
description: description:
- Name of the user you want to create - Name of the user you want to create
@ -174,8 +160,6 @@ user:
type: dict type: dict
''' '''
import os
import re
import traceback import traceback
GITLAB_IMP_ERR = None GITLAB_IMP_ERR = None
@ -298,7 +282,7 @@ class GitLabUser(object):
def findMember(self, group, user_id): def findMember(self, group, user_id):
try: try:
member = group.members.get(user_id) member = group.members.get(user_id)
except gitlab.exceptions.GitlabGetError as e: except gitlab.exceptions.GitlabGetError:
return None return None
return member return member
@ -409,21 +393,10 @@ class GitLabUser(object):
return user.delete() return user.delete()
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"]),
name=dict(type='str', required=True), name=dict(type='str', required=True),
state=dict(type='str', default="present", choices=["absent", "present"]), state=dict(type='str', default="present", choices=["absent", "present"]),
username=dict(type='str', required=True), username=dict(type='str', required=True),
@ -441,41 +414,23 @@ 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']
user_name = module.params['name'] user_name = module.params['name']
state = module.params['state'] state = module.params['state']
user_username = module.params['username'].lower() user_username = module.params['username'].lower()

Loading…
Cancel
Save