From 049a158638fd19ab428985cd05132436743d7c0e Mon Sep 17 00:00:00 2001 From: Joe Garcia Date: Tue, 7 Feb 2023 10:47:51 -0500 Subject: [PATCH] Fixes ansible/awx #13527 --- awx/main/credential_plugins/conjur.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/credential_plugins/conjur.py b/awx/main/credential_plugins/conjur.py index 5510667d4c..83232cccac 100644 --- a/awx/main/credential_plugins/conjur.py +++ b/awx/main/credential_plugins/conjur.py @@ -70,7 +70,8 @@ def conjur_backend(**kwargs): auth_kwargs['verify'] = cert try: resp = requests.post(urljoin(url, '/'.join(['authn', account, username, 'authenticate'])), **auth_kwargs) - except requests.exceptions.ConnectionError: + resp.raise_for_status() + except requests.exceptions.HTTPError: resp = requests.post(urljoin(url, '/'.join(['api', 'authn', account, username, 'authenticate'])), **auth_kwargs) raise_for_status(resp) token = resp.content.decode('utf-8') @@ -92,7 +93,8 @@ def conjur_backend(**kwargs): lookup_kwargs['verify'] = cert try: resp = requests.get(path, timeout=30, **lookup_kwargs) - except requests.exceptions.ConnectionError: + resp.raise_for_status() + except requests.exceptions.HTTPError: resp = requests.get(path_conjurcloud, timeout=30, **lookup_kwargs) raise_for_status(resp) return resp.text