From 34e2d9b47ccc923623627e1d8cfafdb25afb70e4 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Mon, 9 Jul 2018 09:04:14 -0400 Subject: [PATCH] fix regression: include error message from remote server --- awx/plugins/inventory/tower.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/plugins/inventory/tower.py b/awx/plugins/inventory/tower.py index a74e1361da..6f4b7abe9b 100755 --- a/awx/plugins/inventory/tower.py +++ b/awx/plugins/inventory/tower.py @@ -108,7 +108,10 @@ def read_tower_inventory(tower_host, tower_user, tower_pass, inventory, license_ verify=not ignore_ssl) if not response.ok: # 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: # Attempt to parse JSON return response.json()