novatools should handle exceptions more cleanly

Bug #892206 reported by klmitch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
High
Unassigned

Bug Description

For example, when exceeding a quota I get this stacktrace:

    $ novatools boot win102 --image 4 --flavor 3
    Traceback (most recent call last):
      File "/usr/local/bin/novatools", line 9, in <module>
        load_entry_point('python-novatools==1.2', 'console_scripts', 'novatools')()
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/shell.py", line 593, in main
        OpenStackShell().main(sys.argv[1:])
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/shell.py", line 144, in main
        args.func(args)
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/shell.py", line 284, in do_boot
        metadata, files)
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/servers.py", line 222, in create
        return self._create("/servers", body, "server")
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/base.py", line 34, in _create
        resp, body = self.api.client.post(url, body=body)
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/client.py", line 87, in post
        return self._cs_request(url, 'POST', **kwargs)
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/client.py", line 71, in _cs_request
        **kwargs)
      File "/usr/local/lib/python2.6/dist-packages/python_novatools-1.2-py2.6.egg/novatools/client.py", line 57, in request
        raise exceptions.from_response(resp, body)
    novatools.exceptions.OpenStackException: InstanceLimitExceeded: Instance quota exceeded. You can only run 0 more instances of this type. (HTTP 500)

The tool should probably handle any exception due to interacting with the API and print a clean error message to the user. The message from the exception would probably be good.

Revision history for this message
klmitch (q-noreply) wrote :

OpenStack Exceptions were not being correctly caught. Now they only get passed to the os when --debug is supplied. Otherwise, the short-form error message is displayed.

Thierry Carrez (ttx)
affects: nova → python-novaclient
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.