mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 18:37:36 -02:30
Handle json decoder errors from tower inventory source
This commit is contained in:
@@ -108,6 +108,8 @@ def read_tower_inventory(tower_host, tower_user, tower_pass, inventory, license_
|
|||||||
reason = json_reason.get('detail', 'Retrieving Tower Inventory Failed')
|
reason = json_reason.get('detail', 'Retrieving Tower Inventory Failed')
|
||||||
except requests.ConnectionError, e:
|
except requests.ConnectionError, e:
|
||||||
reason = "Connection to remote host failed: {}".format(e)
|
reason = "Connection to remote host failed: {}".format(e)
|
||||||
|
except json.JSONDecodeError, e:
|
||||||
|
reason = "Failed to parse json from host: {}".format(e)
|
||||||
print(reason)
|
print(reason)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user