From 07443a2bcd67e61cdc2ed43828c6ec50fd6ef91d Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 16 Apr 2019 14:17:03 -0500 Subject: [PATCH] Address 2.9 uri deprecations (#55330) * Address 2.9 uri deprecations. Fixes #55310 * Add changelog fragment --- changelogs/fragments/uri-deprecations.yaml | 2 ++ lib/ansible/modules/net_tools/basics/uri.py | 27 ++------------------- test/sanity/validate-modules/ignore.txt | 2 -- 3 files changed, 4 insertions(+), 27 deletions(-) create mode 100644 changelogs/fragments/uri-deprecations.yaml diff --git a/changelogs/fragments/uri-deprecations.yaml b/changelogs/fragments/uri-deprecations.yaml new file mode 100644 index 00000000000..517a7afe193 --- /dev/null +++ b/changelogs/fragments/uri-deprecations.yaml @@ -0,0 +1,2 @@ +minor_changes: +- uri - Remove deprecated ``HEADER_`` support (https://github.com/ansible/ansible/issues/55310) diff --git a/lib/ansible/modules/net_tools/basics/uri.py b/lib/ansible/modules/net_tools/basics/uri.py index a0b6b1c0382..455d7729c92 100644 --- a/lib/ansible/modules/net_tools/basics/uri.py +++ b/lib/ansible/modules/net_tools/basics/uri.py @@ -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 diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 56a35ad1eea..c5866f10fe1 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -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