Removes circular import issues from bin/stack and replaces utils.loads with json.loads. Fixes Bug#704424

This commit is contained in:
jaypipes@gmail.com 2011-01-18 10:24:20 -05:00
parent c9610db6c4
commit 785c5df3d1

View File

@ -22,6 +22,7 @@
import eventlet
eventlet.monkey_patch()
import json
import os
import pprint
import sys
@ -38,7 +39,6 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
import gflags
from nova import utils
FLAGS = gflags.FLAGS
@ -106,8 +106,12 @@ def do_request(controller, method, params=None):
'X-OpenStack-Project': FLAGS.project}
req = urllib2.Request(url, data, headers)
resp = urllib2.urlopen(req)
return utils.loads(resp.read())
try:
resp = urllib2.urlopen(req)
except urllib2.HTTPError, e:
print e.read()
sys.exit(1)
return json.loads(resp.read())
if __name__ == '__main__':