Merge "Issue #2660 Improved error logging in GetBrokerConnections.py" into omaha_14.2.1

Former-commit-id: 7b07fb752c193bb2617fda5921116182fcd86379
This commit is contained in:
Nate Jensen 2014-01-16 17:25:22 -06:00 committed by Gerrit Code Review
commit 055540bcff

View file

@ -26,6 +26,7 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/21/13 1814 rjpeter Updated to use rest API for java broker
# 01/15/14 2660 randerso Log status and reason if request fails
##
import httplib
import json
@ -45,7 +46,8 @@ def getConnections(brokerHost, port=8180):
response = httpConn.getresponse()
if (response.status != 200):
raise Exception("Unable to post request to server")
msg = "Broker %s returned %d %s" % (brokerHost, response.status, response.reason)
raise Exception(msg)
jsonStr = response.read()
jsonObjArray = json.loads(jsonStr)