summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2019-10-20 17:08:08 +0530
committeransibot <ansibot@users.noreply.github.com>2019-10-20 07:38:08 -0400
commitf92c99b4135327629cc2c92995f00102fcf2f681 (patch)
tree5b21c9d31a574cd162119c999015cc0b16bb3996
parent331d51fb16b05f09d3d24d6d6f8d705fa0db4ba7 (diff)
downloadansible-f92c99b4135327629cc2c92995f00102fcf2f681.tar.gz
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>
-rw-r--r--lib/ansible/modules/source_control/gitlab_deploy_key.py34
-rw-r--r--lib/ansible/modules/source_control/gitlab_group.py59
-rw-r--r--lib/ansible/modules/source_control/gitlab_hook.py20
-rw-r--r--lib/ansible/modules/source_control/gitlab_project.py59
-rw-r--r--lib/ansible/modules/source_control/gitlab_runner.py37
-rw-r--r--lib/ansible/modules/source_control/gitlab_user.py57
6 files changed, 40 insertions, 226 deletions
diff --git a/lib/ansible/modules/source_control/gitlab_deploy_key.py b/lib/ansible/modules/source_control/gitlab_deploy_key.py
index 598c57eba7..d820652d83 100644
--- a/lib/ansible/modules/source_control/gitlab_deploy_key.py
+++ b/lib/ansible/modules/source_control/gitlab_deploy_key.py
@@ -34,17 +34,14 @@ options:
- GitLab token for logging in.
version_added: "2.8"
type: str
- aliases:
- - private_token
- - access_token
project:
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
type: str
title:
description:
- - Deploy key's title
+ - Deploy key's title.
required: true
type: str
key:
@@ -54,13 +51,13 @@ options:
type: str
can_push:
description:
- - Whether this key can push to the project
+ - Whether this key can push to the project.
type: bool
default: no
state:
description:
- 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
default: present
type: str
@@ -71,7 +68,7 @@ EXAMPLES = '''
- name: "Adding a project deploy key"
gitlab_deploy_key:
api_url: https://gitlab.example.com/
- api_token: "{{ access_token }}"
+ api_token: "{{ api_token }}"
project: "my_group/my_project"
title: "Jenkins CI"
state: present
@@ -80,7 +77,7 @@ EXAMPLES = '''
- name: "Update the above deploy key to add push access"
gitlab_deploy_key:
api_url: https://gitlab.example.com/
- api_token: "{{ access_token }}"
+ api_token: "{{ api_token }}"
project: "my_group/my_project"
title: "Jenkins CI"
state: present
@@ -89,7 +86,7 @@ EXAMPLES = '''
- name: "Remove the previous deploy key from the project"
gitlab_deploy_key:
api_url: https://gitlab.example.com/
- api_token: "{{ access_token }}"
+ api_token: "{{ api_token }}"
project: "my_group/my_project"
state: absent
key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9w..."
@@ -120,7 +117,6 @@ deploy_key:
type: dict
'''
-import os
import re
import traceback
@@ -181,7 +177,7 @@ class GitLabDeployKey(object):
'''
@param project Project Object
- @param arguments Attributs of the deployKey
+ @param arguments Attributes of the deployKey
'''
def createDeployKey(self, project, arguments):
if self._module.check_mode:
@@ -196,7 +192,7 @@ class GitLabDeployKey(object):
'''
@param deployKey Deploy Key Object
- @param arguments Attributs of the deployKey
+ @param arguments Attributes of the deployKey
'''
def updateDeployKey(self, deployKey, arguments):
changed = False
@@ -238,18 +234,10 @@ class GitLabDeployKey(object):
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():
argument_spec = basic_auth_argument_spec()
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"]),
project=dict(type='str', required=True),
key=dict(type='str', required=True),
@@ -272,8 +260,6 @@ def main():
supports_check_mode=True,
)
- deprecation_warning(module)
-
gitlab_url = re.sub('/api.*', '', module.params['api_url'])
validate_certs = module.params['validate_certs']
gitlab_user = module.params['api_username']
diff --git a/lib/ansible/modules/source_control/gitlab_group.py b/lib/ansible/modules/source_control/gitlab_group.py
index d2f71ab6be..4f7909c2cb 100644
--- a/lib/ansible/modules/source_control/gitlab_group.py
+++ b/lib/ansible/modules/source_control/gitlab_group.py
@@ -29,24 +29,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
name:
description:
- Name of the group you want to create.
@@ -54,7 +40,7 @@ options:
type: str
path:
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.
type: str
description:
@@ -140,7 +126,6 @@ group:
type: dict
'''
-import os
import traceback
GITLAB_IMP_ERR = None
@@ -210,7 +195,7 @@ class GitLabGroup(object):
return False
'''
- @param arguments Attributs of the group
+ @param arguments Attributes of the group
'''
def createGroup(self, arguments):
if self._module.check_mode:
@@ -225,7 +210,7 @@ class GitLabGroup(object):
'''
@param group Group Object
- @param arguments Attributs of the group
+ @param arguments Attributes of the group
'''
def updateGroup(self, group, arguments):
changed = False
@@ -266,21 +251,10 @@ class GitLabGroup(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),
name=dict(type='str', required=True),
path=dict(type='str'),
description=dict(type='str'),
@@ -292,39 +266,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']
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_url = module.params['api_url']
+ gitlab_user = module.params['api_username']
+ gitlab_password = module.params['api_password']
gitlab_token = module.params['api_token']
group_name = module.params['name']
diff --git a/lib/ansible/modules/source_control/gitlab_hook.py b/lib/ansible/modules/source_control/gitlab_hook.py
index cf4f8f5924..cd5f3ae536 100644
--- a/lib/ansible/modules/source_control/gitlab_hook.py
+++ b/lib/ansible/modules/source_control/gitlab_hook.py
@@ -35,9 +35,6 @@ options:
- GitLab token for logging in.
version_added: "2.8"
type: str
- aliases:
- - private_token
- - access_token
project:
description:
- Id or Full path of the project in the form of group/name.
@@ -165,7 +162,6 @@ hook:
type: dict
'''
-import os
import re
import traceback
@@ -242,7 +238,7 @@ class GitLabHook(object):
'''
@param project Project Object
- @param arguments Attributs of the hook
+ @param arguments Attributes of the hook
'''
def createHook(self, project, arguments):
if self._module.check_mode:
@@ -254,7 +250,7 @@ class GitLabHook(object):
'''
@param hook Hook Object
- @param arguments Attributs of the hook
+ @param arguments Attributes of the hook
'''
def updateHook(self, hook, arguments):
changed = False
@@ -296,18 +292,10 @@ class GitLabHook(object):
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():
argument_spec = basic_auth_argument_spec()
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"]),
project=dict(type='str', required=True),
hook_url=dict(type='str', required=True),
@@ -338,8 +326,6 @@ def main():
supports_check_mode=True,
)
- deprecation_warning(module)
-
gitlab_url = re.sub('/api.*', '', module.params['api_url'])
validate_certs = module.params['validate_certs']
gitlab_user = module.params['api_username']
diff --git a/lib/ansible/modules/source_control/gitlab_project.py b/lib/ansible/modules/source_control/gitlab_project.py
index 59a4418e36..910de31690 100644
--- a/lib/ansible/modules/source_control/gitlab_project.py
+++ b/lib/ansible/modules/source_control/gitlab_project.py
@@ -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']
diff --git a/lib/ansible/modules/source_control/gitlab_runner.py b/lib/ansible/modules/source_control/gitlab_runner.py
index a7d140f138..b23216eeb1 100644
--- a/lib/ansible/modules/source_control/gitlab_runner.py
+++ b/lib/ansible/modules/source_control/gitlab_runner.py
@@ -26,7 +26,7 @@ description:
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/).
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.
version_added: 2.8
author:
@@ -38,17 +38,11 @@ requirements:
extends_documentation_fragment:
- auth_basic
options:
- url:
- description:
- - The URL of the GitLab server, with protocol (i.e. http or https).
- type: str
api_token:
description:
- Your private token to interact with the GitLab API.
required: True
type: str
- aliases:
- - private_token
description:
description:
- The unique name of the runner.
@@ -151,8 +145,6 @@ runner:
type: dict
'''
-import os
-import re
import traceback
GITLAB_IMP_ERR = None
@@ -217,7 +209,7 @@ class GitLabRunner(object):
return False
'''
- @param arguments Attributs of the runner
+ @param arguments Attributes of the runner
'''
def createRunner(self, arguments):
if self._module.check_mode:
@@ -232,7 +224,7 @@ class GitLabRunner(object):
'''
@param runner Runner object
- @param arguments Attributs of the runner
+ @param arguments Attributes of the runner
'''
def updateRunner(self, runner, arguments):
changed = False
@@ -284,19 +276,10 @@ class GitLabRunner(object):
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():
argument_spec = basic_auth_argument_spec()
argument_spec.update(dict(
- url=dict(type='str', removed_in_version="2.10"),
- api_token=dict(type='str', no_log=True, aliases=["private_token"]),
+ api_token=dict(type='str', no_log=True),
description=dict(type='str', required=True, aliases=["name"]),
active=dict(type='bool', default=True),
tag_list=dict(type='list', default=[]),
@@ -311,30 +294,20 @@ def main():
module = AnsibleModule(
argument_spec=argument_spec,
mutually_exclusive=[
- ['api_url', 'url'],
['api_username', 'api_token'],
['api_password', 'api_token'],
],
required_together=[
['api_username', 'api_password'],
- ['login_user', 'login_password'],
],
required_one_of=[
['api_username', 'api_token'],
- ['api_url', 'url']
],
supports_check_mode=True,
)
- deprecation_warning(module)
-
- if module.params['url'] is not None:
- url = re.sub('/api.*', '', module.params['url'])
-
- api_url = module.params['api_url']
+ gitlab_url = module.params['api_url']
validate_certs = module.params['validate_certs']
-
- gitlab_url = url if api_url is None else api_url
gitlab_user = module.params['api_username']
gitlab_password = module.params['api_password']
gitlab_token = module.params['api_token']
diff --git a/lib/ansible/modules/source_control/gitlab_user.py b/lib/ansible/modules/source_control/gitlab_user.py
index 43b8e68920..f97e0f94a8 100644
--- a/lib/ansible/modules/source_control/gitlab_user.py
+++ b/lib/ansible/modules/source_control/gitlab_user.py
@@ -31,24 +31,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
name:
description:
- Name of the user you want to create
@@ -174,8 +160,6 @@ user:
type: dict
'''
-import os
-import re
import traceback
GITLAB_IMP_ERR = None
@@ -298,7 +282,7 @@ class GitLabUser(object):
def findMember(self, group, user_id):
try:
member = group.members.get(user_id)
- except gitlab.exceptions.GitlabGetError as e:
+ except gitlab.exceptions.GitlabGetError:
return None
return member
@@ -409,21 +393,10 @@ class GitLabUser(object):
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():
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),
name=dict(type='str', required=True),
state=dict(type='str', default="present", choices=["absent", "present"]),
username=dict(type='str', required=True),
@@ -441,41 +414,23 @@ 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']
-
user_name = module.params['name']
state = module.params['state']
user_username = module.params['username'].lower()