From 89a05e9bbcca16d291844ece87a973b9819a0195 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 6 Nov 2017 14:15:20 -0500 Subject: [PATCH] Handle json decoder errors from tower inventory source --- awx/plugins/inventory/tower.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awx/plugins/inventory/tower.py b/awx/plugins/inventory/tower.py index 263cd5eebf..233f623bda 100755 --- a/awx/plugins/inventory/tower.py +++ b/awx/plugins/inventory/tower.py @@ -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)