diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-25 22:06:00 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-25 22:06:00 +0000 |
| commit | 6908fbf2f819482e99fd266985e9d16cb97e2bb8 (patch) | |
| tree | 0fce1e4b2143bde3e51f274ab412b1913cac3cb9 /nova/api | |
| parent | 21a0120ceef04355111c533f90b40141b6ae5426 (diff) | |
| parent | 5522507bd7ff51ad8a55f8318c327ace3157675d (diff) | |
| download | nova-6908fbf2f819482e99fd266985e9d16cb97e2bb8.tar.gz nova-6908fbf2f819482e99fd266985e9d16cb97e2bb8.tar.xz nova-6908fbf2f819482e99fd266985e9d16cb97e2bb8.zip | |
Merge "Return 400 in get_console_output for bad length."
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/console_output.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/nova/api/openstack/compute/contrib/console_output.py b/nova/api/openstack/compute/contrib/console_output.py index 7a16daec3..c29177a07 100644 --- a/nova/api/openstack/compute/contrib/console_output.py +++ b/nova/api/openstack/compute/contrib/console_output.py @@ -49,14 +49,22 @@ class ConsoleOutputController(wsgi.Controller): try: length = body['os-getConsoleOutput'].get('length') except (TypeError, KeyError): - raise webob.exc.HTTPBadRequest(_('Malformed request body')) + raise webob.exc.HTTPBadRequest(_('os-getConsoleOutput malformed or ' + 'missing from request body')) + + if length is not None: + try: + int(length) + except ValueError: + raise webob.exc.HTTPBadRequest(_('Length in request body must ' + 'be an integer value')) try: output = self.compute_api.get_console_output(context, instance, length) except exception.NotFound: - raise webob.exc.HTTPNotFound(_('Instance not found')) + raise webob.exc.HTTPNotFound(_('Unable to get console')) # XML output is not correctly escaped, so remove invalid characters remove_re = re.compile('[\x00-\x08\x0B-\x0C\x0E-\x1F]') @@ -64,7 +72,6 @@ class ConsoleOutputController(wsgi.Controller): return {'output': output} - class Console_output(extensions.ExtensionDescriptor): """Console log output support, with tailing ability.""" |
