mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 21:46:00 -03:30
presume 401 from insights means invalid credential
* Tell the user about the invalid credentials
This commit is contained in:
@@ -2116,7 +2116,9 @@ class HostInsights(GenericAPIView):
|
||||
except requests.exceptions.RequestException as e:
|
||||
return (dict(error=_('Unkown exception {} while trying to GET {}').format(e, url)), status.HTTP_502_BAD_GATEWAY)
|
||||
|
||||
if res.status_code != 200:
|
||||
if res.status_code == 401:
|
||||
return (dict(error=_('Unauthorized access. Please check your Insights Credential username and password.')), status.HTTP_502_BAD_GATEWAY)
|
||||
elif res.status_code != 200:
|
||||
return (dict(error=_('Failed to gather reports and maintenance plans from Insights API at URL {}. Server responded with {} status code and message {}').format(url, res.status_code, res.content)), status.HTTP_502_BAD_GATEWAY)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user