From e6ed883ffdc49bd7a29bbae6fbf3df390891810b Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 1 Nov 2018 13:10:44 -0400 Subject: [PATCH] [backport 2.7] Fixes HTTP redirect issue (#45513) (#47822) * Fixes HTTP redirect issue (#45513) (cherry picked from commit e701b5a4127f114c0f20ac5160c2577e73f0b39a) * add changelog fragment --- .../fragments/45704-fix-redfish_facts-http-redirect.yaml | 2 ++ lib/ansible/module_utils/redfish_utils.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/45704-fix-redfish_facts-http-redirect.yaml diff --git a/changelogs/fragments/45704-fix-redfish_facts-http-redirect.yaml b/changelogs/fragments/45704-fix-redfish_facts-http-redirect.yaml new file mode 100644 index 0000000000..84a8f71871 --- /dev/null +++ b/changelogs/fragments/45704-fix-redfish_facts-http-redirect.yaml @@ -0,0 +1,2 @@ +bugfixes: +- "Fix issue with HTTP redirects with redfish_facts module (https://github.com/ansible/ansible/pull/45704)" diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py index 0f98139b08..096532e443 100644 --- a/lib/ansible/module_utils/redfish_utils.py +++ b/lib/ansible/module_utils/redfish_utils.py @@ -27,7 +27,8 @@ class RedfishUtils(object): url_username=self.creds['user'], url_password=self.creds['pswd'], force_basic_auth=True, validate_certs=False, - timeout=10, use_proxy=False) + follow_redirects='all', + use_proxy=False) data = json.loads(resp.read()) except HTTPError as e: return {'ret': False, 'msg': "HTTP Error: %s" % e.code} @@ -45,6 +46,7 @@ class RedfishUtils(object): url_username=self.creds['user'], url_password=self.creds['pswd'], force_basic_auth=True, validate_certs=False, + follow_redirects='all', use_proxy=False) except HTTPError as e: return {'ret': False, 'msg': "HTTP Error: %s" % e.code} @@ -62,6 +64,7 @@ class RedfishUtils(object): url_username=self.creds['user'], url_password=self.creds['pswd'], force_basic_auth=True, validate_certs=False, + follow_redirects='all', use_proxy=False) except HTTPError as e: return {'ret': False, 'msg': "HTTP Error: %s" % e.code} @@ -79,6 +82,7 @@ class RedfishUtils(object): url_username=self.creds['user'], url_password=self.creds['pswd'], force_basic_auth=True, validate_certs=False, + follow_redirects='all', use_proxy=False) except HTTPError as e: return {'ret': False, 'msg': "HTTP Error: %s" % e.code}