From 6e8e90ceb4c6ceb77c9e7a5fd8ede53e5597fd8e Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 1 Mar 2017 10:35:48 -0600 Subject: [PATCH] Warn when using the deprecated HEADER_ arguments (#20236) * Make sure the uri module warns about using the deprecated HEADER_ arguments, so that we can actually deprecate in a future version * Use module.deprecate * No need to de-dupe ourselves, looks like it is done somewhere I didn't initially see --- lib/ansible/modules/network/basics/uri.py | 3 +++ test/integration/targets/uri/tasks/main.yml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/basics/uri.py b/lib/ansible/modules/network/basics/uri.py index 356993e3cf7..9f1cd36da77 100644 --- a/lib/ansible/modules/network/basics/uri.py +++ b/lib/ansible/modules/network/basics/uri.py @@ -413,6 +413,9 @@ def main(): # 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') skey = key.replace("HEADER_", "") dict_headers[skey] = value diff --git a/test/integration/targets/uri/tasks/main.yml b/test/integration/targets/uri/tasks/main.yml index f9fd00bec24..30fd46eb139 100644 --- a/test/integration/targets/uri/tasks/main.yml +++ b/test/integration/targets/uri/tasks/main.yml @@ -180,7 +180,8 @@ url: 'http://{{ httpbin_host }}/digest-auth/auth/user/passwd' user: user password: passwd - HEADER_Cookie: "fake=fake_value" + headers: + Cookie: "fake=fake_value" - name: test PUT uri: