1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove the params option from jenkns_plugin and yum_repository (#32708)

* Remove the params option from jenkns_plugin and yum_repository

It was decided that these options which override Ansible module options
from a generic, unchecked dict are an antipattern for Ansible Modules
and must be removed:

https://meetbot.fedoraproject.org/ansible-meeting/2017-09-28/ansible_dev_meeting.2017-09-28-15.00.log.html

Fixes #30874
This commit is contained in:
Toshio Kuratomi 2017-11-08 13:59:59 -08:00 committed by GitHub
parent 80967380d3
commit facbf7f14d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 29 deletions

View file

@ -29,6 +29,8 @@ Ansible Changes By Release
* Added support to `become` `NT AUTHORITY\System`, `NT AUTHORITY\LocalService`, and `NT AUTHORITY\NetworkService` on Windows hosts * Added support to `become` `NT AUTHORITY\System`, `NT AUTHORITY\LocalService`, and `NT AUTHORITY\NetworkService` on Windows hosts
* Fixed `become` to work with async on Windows hosts * Fixed `become` to work with async on Windows hosts
* Improved `become` elevation process to work on standard Administrator users without disabling UAC on Windows hosts * Improved `become` elevation process to work on standard Administrator users without disabling UAC on Windows hosts
* The jenkins_plugin and yum_repository plugins had their `params` option
removed due to circumventing Ansible's option processing.
### New Plugins ### New Plugins

View file

@ -241,12 +241,6 @@ options:
- Unique repository ID. - Unique repository ID.
- This parameter is only required if I(state) is set to C(present) or - This parameter is only required if I(state) is set to C(present) or
C(absent). C(absent).
params:
required: false
default: null
description:
- Option used to allow the user to overwrite any of the other options.
To remove an option, set the value of the option to C(null).
password: password:
required: false required: false
default: null default: null
@ -391,6 +385,8 @@ notes:
- The repo file will be automatically deleted if it contains no repository. - The repo file will be automatically deleted if it contains no repository.
- When removing a repository, beware that the metadata cache may still remain - When removing a repository, beware that the metadata cache may still remain
on disk until you run C(yum clean all). Use a notification handler for this. on disk until you run C(yum clean all). Use a notification handler for this.
- "The C(params) parameter was removed in Ansible 2.5 due to circumventing Ansible's parameter
handling"
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -699,11 +695,11 @@ def main():
supports_check_mode=True, supports_check_mode=True,
) )
# Update module parameters by user's parameters if defined # Params was removed
if 'params' in module.params and isinstance(module.params['params'], dict): # https://meetbot.fedoraproject.org/ansible-meeting/2017-09-28/ansible_dev_meeting.2017-09-28-15.00.log.html
module.params.update(module.params['params']) if module.params['params']:
# Remove the params module.fail_json(msg="The params option to yum_repository was removed in Ansible 2.5"
module.params.pop('params', None) "since it circumvents Ansible's option handling")
name = module.params['name'] name = module.params['name']
state = module.params['state'] state = module.params['state']

View file

@ -46,14 +46,6 @@ options:
default: jenkins default: jenkins
description: description:
- Name of the Jenkins user on the OS. - Name of the Jenkins user on the OS.
params:
required: false
default: null
description:
- Option used to allow the user to overwrite any of the other options. To
remove an option, set the value of the option to C(null).
- Changed in 2.5.0, 2.4.1, 2.3.3 to raise an error if C(url_password) is specified in params.
Use the actual C(url_password) argument instead.
state: state:
required: false required: false
choices: [absent, present, pinned, unpinned, enabled, disabled, latest] choices: [absent, present, pinned, unpinned, enabled, disabled, latest]
@ -120,6 +112,8 @@ notes:
- It is not possible to run the module remotely by changing the I(url) - It is not possible to run the module remotely by changing the I(url)
parameter to point to the Jenkins server. The module must be used on the parameter to point to the Jenkins server. The module must be used on the
host where Jenkins runs as it needs direct access to the plugin files. host where Jenkins runs as it needs direct access to the plugin files.
- "The C(params) option was removed in Ansible 2.5 due to circumventing Ansible's
option handling"
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -762,16 +756,11 @@ def main():
supports_check_mode=True, supports_check_mode=True,
) )
# Update module parameters by user's parameters if defined # Params was removed
if 'params' in module.params and isinstance(module.params['params'], dict): # https://meetbot.fedoraproject.org/ansible-meeting/2017-09-28/ansible_dev_meeting.2017-09-28-15.00.log.html
if 'url_password' in module.params['params']: if module.params['params']:
# The params argument should be removed eventually. Until then, raise an error if module.fail_json(msg="The params option to jenkins_plugin was removed in Ansible 2.5"
# url_password is specified there as it can lead to the password being logged "since it circumvents Ansible's option handling")
module.fail_json(msg='Do not specify url_password in params as it may get logged')
module.params.update(module.params['params'])
# Remove the params
module.params.pop('params', None)
# Force basic authentication # Force basic authentication
module.params['force_basic_auth'] = True module.params['force_basic_auth'] = True