Address 2.9 uri deprecations (#55330)

* Address 2.9 uri deprecations. Fixes #55310

* Add changelog fragment
This commit is contained in:
Matt Martz 2019-04-16 14:17:03 -05:00 committed by GitHub
parent 9f83139dcb
commit 07443a2bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 27 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- uri - Remove deprecated ``HEADER_`` support (https://github.com/ansible/ansible/issues/55310)

View file

@ -91,7 +91,7 @@ options:
where C(yes) is the equivalent of C(all) and C(no) is the equivalent of C(safe). C(yes) and C(no)
are deprecated and will be removed in some future version of Ansible.
type: str
choices: [ all, 'none', safe ]
choices: ['all', 'no', 'none', 'safe', 'urllib2', 'yes']
default: safe
creates:
description:
@ -111,14 +111,6 @@ options:
- The socket level timeout in seconds
type: int
default: 30
HEADER_:
description:
- 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 will be removed in Ansible 2.9.
Use I(headers) instead.
type: dict
headers:
description:
- Add custom HTTP headers to a request in the format of a YAML hash. As
@ -126,9 +118,6 @@ options:
generated by supplying C(json) or C(form-urlencoded) for I(body_format).
type: dict
version_added: '2.1'
others:
description:
- All arguments accepted by the M(file) module also work here
validate_certs:
description:
- If C(no), SSL certificates will not be validated.
@ -191,6 +180,7 @@ seealso:
- module: win_uri
author:
- Romeo Theriault (@romeotheriault)
extends_documentation_fragment: files
'''
EXAMPLES = r'''
@ -531,8 +521,6 @@ 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,
mutually_exclusive=[['body', 'src']],
)
@ -568,17 +556,6 @@ def main():
if 'content-type' not in [header.lower() for header in dict_headers]:
dict_headers['Content-Type'] = 'application/x-www-form-urlencoded'
# 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 iteritems(module.params):
if key.startswith("HEADER_"):
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
# and the filename already exists. This allows idempotence

View file

@ -393,8 +393,6 @@ lib/ansible/modules/monitoring/sensu_check.py E324
lib/ansible/modules/monitoring/sensu_client.py E324
lib/ansible/modules/monitoring/sensu_handler.py E326
lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py E317
lib/ansible/modules/net_tools/basics/uri.py E323
lib/ansible/modules/net_tools/basics/uri.py E326
lib/ansible/modules/network/a10/a10_server_axapi3.py E326
lib/ansible/modules/network/a10/a10_virtual_server.py E324
lib/ansible/modules/network/asa/asa_config.py E324