mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
fix regression: include error message from remote server
This commit is contained in:
parent
da0fe173c9
commit
34e2d9b47c
@ -108,7 +108,10 @@ def read_tower_inventory(tower_host, tower_user, tower_pass, inventory, license_
|
|||||||
verify=not ignore_ssl)
|
verify=not ignore_ssl)
|
||||||
if not response.ok:
|
if not response.ok:
|
||||||
# If the GET /api/v2/inventories/N/script is not HTTP 200, print the error code
|
# If the GET /api/v2/inventories/N/script is not HTTP 200, print the error code
|
||||||
raise RuntimeError("Connection to remote host failed: {}".format(response))
|
msg = "Connection to remote host failed: {}".format(response)
|
||||||
|
if response.text:
|
||||||
|
msg += " with message: {}".format(response.text)
|
||||||
|
raise RuntimeError(msg)
|
||||||
try:
|
try:
|
||||||
# Attempt to parse JSON
|
# Attempt to parse JSON
|
||||||
return response.json()
|
return response.json()
|
||||||
|
Loading…
Reference in New Issue
Block a user