mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Deprecate check_invalid_arguments (#34004)
* Deprecate check_invalid_arguments Check_invalid_arguments is a piece of functionality from the early days of Ansible that should not be used. We'll remove it in Ansible 2.9. Deprecating it for now.
This commit is contained in:
parent
7bc754674c
commit
cc7a5228b0
6 changed files with 82 additions and 16 deletions
|
@ -101,8 +101,8 @@ options:
|
|||
- Any parameter starting with "HEADER_" is a sent with your request as a header.
|
||||
For example, HEADER_Content-Type="application/json" would send the header
|
||||
"Content-Type" along with your request with a value of "application/json".
|
||||
This option is deprecated as of C(2.1) and may be removed in a future
|
||||
release. Use I(headers) instead.
|
||||
This option is deprecated as of C(2.1) and will be removed in Ansible-2.9.
|
||||
Use I(headers) instead.
|
||||
headers:
|
||||
description:
|
||||
- Add custom HTTP headers to a request in the format of a YAML hash. As
|
||||
|
@ -386,6 +386,7 @@ def main():
|
|||
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
# TODO: Remove check_invalid_arguments in 2.9
|
||||
check_invalid_arguments=False,
|
||||
add_file_common_args=True
|
||||
)
|
||||
|
@ -411,15 +412,16 @@ def main():
|
|||
if 'content-type' not in lower_header_keys:
|
||||
dict_headers['Content-Type'] = 'application/json'
|
||||
|
||||
# TODO: Deprecated section. Remove in Ansible 2.9
|
||||
# Grab all the http headers. Need this hack since passing multi-values is
|
||||
# currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')
|
||||
for key, value in six.iteritems(module.params):
|
||||
if key.startswith("HEADER_"):
|
||||
module.deprecate('Supplying headers via HEADER_* is deprecated and '
|
||||
'will be removed in a future version. Please use '
|
||||
'`headers` to supply headers for the request')
|
||||
module.deprecate('Supplying headers via HEADER_* is deprecated. Please use `headers` to'
|
||||
' supply headers for the request', version='2.9')
|
||||
skey = key.replace("HEADER_", "")
|
||||
dict_headers[skey] = value
|
||||
# End deprecated section
|
||||
|
||||
if creates is not None:
|
||||
# do not run the command if the line contains creates=filename
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue