From 30132861af49ba7e3b9697de51305ca88a912b2c Mon Sep 17 00:00:00 2001 From: Benjamin <1982589+tumbl3w33d@users.noreply.github.com> Date: Mon, 9 Dec 2019 11:26:12 +0100 Subject: [PATCH] Introduce force_basic_auth for maven_artifact (#64808) as it's known from uri or get_url. Causes basic auth header to be sent on first request to avoid trouble with some receiving ends. Fixes #64595 --- .../modules/packaging/language/maven_artifact.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/modules/packaging/language/maven_artifact.py b/lib/ansible/modules/packaging/language/maven_artifact.py index b1ed404b890..47c2c234a54 100644 --- a/lib/ansible/modules/packaging/language/maven_artifact.py +++ b/lib/ansible/modules/packaging/language/maven_artifact.py @@ -73,6 +73,15 @@ options: - Add custom HTTP headers to a request in hash/dict format. type: dict version_added: "2.8" + force_basic_auth: + version_added: "2.10" + description: + - httplib2, the library used by the uri module only sends authentication information when a webservice + responds to an initial request with a 401 status. Since some basic auth services do not properly + send a 401, logins will fail. This option forces the sending of the Basic authentication header + upon initial request. + default: 'no' + type: bool dest: description: - The path where the artifact should be written to @@ -548,6 +557,7 @@ def main(): username=dict(default=None, aliases=['aws_secret_key']), password=dict(default=None, no_log=True, aliases=['aws_secret_access_key']), headers=dict(type='dict'), + force_basic_auth=dict(default=False, type='bool'), state=dict(default="present", choices=["present", "absent"]), # TODO - Implement a "latest" state timeout=dict(default=10, type='int'), dest=dict(type="path", required=True),