Handle json decoder errors from tower inventory source

This commit is contained in:
Matthew Jones 2017-11-06 14:15:20 -05:00
parent 96fbc9ea27
commit 89a05e9bbc
No known key found for this signature in database
GPG Key ID: 76A4C17A97590C1C

View File

@ -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')
except requests.ConnectionError, e:
reason = "Connection to remote host failed: {}".format(e)
except json.JSONDecodeError, e:
reason = "Failed to parse json from host: {}".format(e)
print(reason)
sys.exit(1)