diff options
author | jaypipes@gmail.com <> | 2011-01-19 22:46:31 +0000 |
---|---|---|
committer | Tarmac <> | 2011-01-19 22:46:31 +0000 |
commit | 97d9b426f80544dd6cc82f5753783d2bf8f3957f (patch) | |
tree | 20e8c2a5930106bbbda88ce02733120a54eb29e5 | |
parent | c25a105ead4cd571a1089d2dabf9f338afdd4784 (diff) | |
parent | 2f4e7b732d5cafd09a5a73cbc01583503b8ba105 (diff) | |
download | nova-97d9b426f80544dd6cc82f5753783d2bf8f3957f.tar.gz nova-97d9b426f80544dd6cc82f5753783d2bf8f3957f.tar.xz nova-97d9b426f80544dd6cc82f5753783d2bf8f3957f.zip |
Fixes for bugs:
* Bug #704422: nova-direct-api: AttributeError: 'module' object has no attribute 'ComputeAPI'
* Bug #704424: bin/stack: AttributeError: port
* Bug #704447: bin/stack: urllib2.HTTPError when issuing reflection request
-rwxr-xr-x | bin/nova-direct-api | 2 | ||||
-rwxr-xr-x | bin/stack | 10 | ||||
-rw-r--r-- | nova/api/direct.py | 10 |
3 files changed, 16 insertions, 6 deletions
diff --git a/bin/nova-direct-api b/bin/nova-direct-api index e7dd14fb2..173b39bdb 100755 --- a/bin/nova-direct-api +++ b/bin/nova-direct-api @@ -49,7 +49,7 @@ if __name__ == '__main__': utils.default_flagfile() FLAGS(sys.argv) - direct.register_service('compute', compute_api.ComputeAPI()) + direct.register_service('compute', compute_api.API()) direct.register_service('reflect', direct.Reflection()) router = direct.Router() with_json = direct.JsonParamsMiddleware(router) @@ -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__': diff --git a/nova/api/direct.py b/nova/api/direct.py index 509ab3ae0..208b6d086 100644 --- a/nova/api/direct.py +++ b/nova/api/direct.py @@ -142,9 +142,15 @@ class Reflection(object): if argspec[2]: args_out.insert(0, ('**%s' % argspec[2],)) + if f.__doc__: + short_doc = f.__doc__.split('\n')[0] + doc = f.__doc__ + else: + short_doc = doc = _('not available') + methods['/%s/%s' % (route, k)] = { - 'short_doc': f.__doc__.split('\n')[0], - 'doc': f.__doc__, + 'short_doc': short_doc, + 'doc': doc, 'name': k, 'args': list(reversed(args_out))} |