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
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

@ -241,12 +241,6 @@ options:
- Unique repository ID.
- This parameter is only required if I(state) is set to C(present) or
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:
required: false
default: null
@ -391,6 +385,8 @@ notes:
- The repo file will be automatically deleted if it contains no repository.
- 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.
- "The C(params) parameter was removed in Ansible 2.5 due to circumventing Ansible's parameter
handling"
'''
EXAMPLES = '''
@ -699,11 +695,11 @@ def main():
supports_check_mode=True,
)
# Update module parameters by user's parameters if defined
if 'params' in module.params and isinstance(module.params['params'], dict):
module.params.update(module.params['params'])
# Remove the params
module.params.pop('params', None)
# Params was removed
# https://meetbot.fedoraproject.org/ansible-meeting/2017-09-28/ansible_dev_meeting.2017-09-28-15.00.log.html
if module.params['params']:
module.fail_json(msg="The params option to yum_repository was removed in Ansible 2.5"
"since it circumvents Ansible's option handling")
name = module.params['name']
state = module.params['state']