Fix Gitlab module deprecation warning (#60425)
* gitlab modules : Fix deprecation warnings and parameters Also preparing for 2.10 deprecation * gitlab modules : Correct deprecation message
This commit is contained in:
parent
e9d10f94b7
commit
7bb90999d3
6 changed files with 32 additions and 19 deletions
|
@ -241,7 +241,9 @@ class GitLabDeployKey(object):
|
|||
def deprecation_warning(module):
|
||||
deprecated_aliases = ['private_token', 'access_token']
|
||||
|
||||
module.deprecate("Aliases \'{aliases}\' are deprecated".format(aliases='\', \''.join(deprecated_aliases)), "2.10")
|
||||
for aliase in deprecated_aliases:
|
||||
if aliase in module.params:
|
||||
module.deprecate("Alias \'{aliase}\' is deprecated".format(aliase=aliase), "2.10")
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -32,7 +32,6 @@ options:
|
|||
server_url:
|
||||
description:
|
||||
- The URL of the GitLab server, with protocol (i.e. http or https).
|
||||
required: true
|
||||
type: str
|
||||
login_user:
|
||||
description:
|
||||
|
@ -270,7 +269,9 @@ class GitLabGroup(object):
|
|||
def deprecation_warning(module):
|
||||
deprecated_aliases = ['login_token']
|
||||
|
||||
module.deprecate("Aliases \'{aliases}\' are deprecated".format(aliases='\', \''.join(deprecated_aliases)), "2.10")
|
||||
for aliase in deprecated_aliases:
|
||||
if aliase in module.params:
|
||||
module.deprecate("Alias \'{aliase}\' is deprecated".format(aliase=aliase), "2.10")
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -304,7 +305,8 @@ def main():
|
|||
['login_user', 'login_password'],
|
||||
],
|
||||
required_one_of=[
|
||||
['api_username', 'api_token', 'login_user', 'login_token']
|
||||
['api_username', 'api_token', 'login_user', 'login_token'],
|
||||
['server_url', 'api_url']
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -297,9 +297,11 @@ class GitLabHook(object):
|
|||
|
||||
|
||||
def deprecation_warning(module):
|
||||
deprecated_aliases = ['private_token', 'access_token']
|
||||
deprecated_aliases = ['private_token', 'access_token', 'enable_ssl_verification']
|
||||
|
||||
module.deprecate("Aliases \'{aliases}\' are deprecated".format(aliases='\', \''.join(deprecated_aliases)), "2.10")
|
||||
for aliase in deprecated_aliases:
|
||||
if aliase in module.params:
|
||||
module.deprecate("Alias \'{aliase}\' is deprecated".format(aliase=aliase), "2.10")
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -33,7 +33,6 @@ options:
|
|||
server_url:
|
||||
description:
|
||||
- The URL of the GitLab server, with protocol (i.e. http or https).
|
||||
required: true
|
||||
type: str
|
||||
login_user:
|
||||
description:
|
||||
|
@ -289,7 +288,9 @@ class GitLabProject(object):
|
|||
def deprecation_warning(module):
|
||||
deprecated_aliases = ['login_token']
|
||||
|
||||
module.deprecate("Aliases \'{aliases}\' are deprecated".format(aliases='\', \''.join(deprecated_aliases)), "2.10")
|
||||
for aliase in deprecated_aliases:
|
||||
if aliase in module.params:
|
||||
module.deprecate("Alias \'{aliase}\' is deprecated".format(aliase=aliase), "2.10")
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -328,7 +329,8 @@ def main():
|
|||
['login_user', 'login_password'],
|
||||
],
|
||||
required_one_of=[
|
||||
['api_username', 'api_token', 'login_user', 'login_token']
|
||||
['api_username', 'api_token', 'login_user', 'login_token'],
|
||||
['server_url', 'api_url']
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -41,7 +41,6 @@ options:
|
|||
url:
|
||||
description:
|
||||
- The URL of the GitLab server, with protocol (i.e. http or https).
|
||||
required: true
|
||||
type: str
|
||||
api_token:
|
||||
description:
|
||||
|
@ -286,15 +285,17 @@ class GitLabRunner(object):
|
|||
|
||||
|
||||
def deprecation_warning(module):
|
||||
deprecated_aliases = ['login_token']
|
||||
deprecated_aliases = ['private_token']
|
||||
|
||||
module.deprecate("Aliases \'{aliases}\' are deprecated".format(aliases='\', \''.join(deprecated_aliases)), "2.10")
|
||||
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', required=True, removed_in_version="2.10"),
|
||||
url=dict(type='str', removed_in_version="2.10"),
|
||||
api_token=dict(type='str', no_log=True, aliases=["private_token"]),
|
||||
description=dict(type='str', required=True, aliases=["name"]),
|
||||
active=dict(type='bool', default=True),
|
||||
|
@ -319,14 +320,16 @@ def main():
|
|||
['login_user', 'login_password'],
|
||||
],
|
||||
required_one_of=[
|
||||
['api_username', 'api_token']
|
||||
['api_username', 'api_token'],
|
||||
['api_url', 'url']
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
deprecation_warning(module)
|
||||
|
||||
url = re.sub('/api.*', '', module.params['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']
|
||||
|
|
|
@ -34,7 +34,6 @@ options:
|
|||
server_url:
|
||||
description:
|
||||
- The URL of the GitLab server, with protocol (i.e. http or https).
|
||||
required: true
|
||||
type: str
|
||||
login_user:
|
||||
description:
|
||||
|
@ -411,13 +410,15 @@ class GitLabUser(object):
|
|||
def deprecation_warning(module):
|
||||
deprecated_aliases = ['login_token']
|
||||
|
||||
module.deprecate("Aliases \'{aliases}\' are deprecated".format(aliases='\', \''.join(deprecated_aliases)), "2.10")
|
||||
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', required=True, removed_in_version="2.10"),
|
||||
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"]),
|
||||
|
@ -451,7 +452,8 @@ def main():
|
|||
['login_user', 'login_password'],
|
||||
],
|
||||
required_one_of=[
|
||||
['api_username', 'api_token', 'login_user', 'login_token']
|
||||
['api_username', 'api_token', 'login_user', 'login_token'],
|
||||
['server_url', 'api_url']
|
||||
],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue