API returns 500 error on yaml parse error

Bug #1185590 reported by Steve Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Jianing Yang

Bug Description

http://192.168.1.70:8004/v1/3065228f11004066bce5270f0da6a1b7/validate
DEBUG (http:122)
HTTP/1.1 500 Internal Server Error
date: Wed, 29 May 2013 21:50:54 GMT
content-length: 5982
content-type: text/plain
connection: close

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/eventlet/wsgi.py", line 383, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 306, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/python_keystoneclient-0.2.3.14.g8f80678-py2.7.egg/keystoneclient/middleware/auth_token.py", line 451, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 306, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/site-packages/Routes-1.12.3-py2.7.egg/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 564, in __call__
    request, **action_args)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 606, in dispatch
    return method(*args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/util.py", line 30, in handle_stack_method
    return handler(controller, req, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/stacks.py", line 294, in validate_template
    data.template())
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/stacks.py", line 99, in template
    return self.format_parse(template_data, 'Template')
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/stacks.py", line 66, in format_parse
    return template_format.parse(data)
  File "/home/steveb/dev/localstack/heat/heat/common/template_format.py", line 42, in parse
    tpl = yaml.safe_load(tmpl_str)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/__init__.py", line 93, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/__init__.py", line 71, in load
    return loader.get_single_data()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/constructor.py", line 37, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
ParserError: while parsing a block mapping
  in "<unicode string>", line 5, column 5:
        Description: Name of an existing ...
        ^
expected <block end>, but found ','
  in "<unicode string>", line 7, column 19:
        MinLength: '1',
                      ^

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/eventlet/wsgi.py", line 383, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 306, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/python_keystoneclient-0.2.3.14.g8f80678-py2.7.egg/keystoneclient/middleware/auth_token.py", line 451, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 306, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/site-packages/Routes-1.12.3-py2.7.egg/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/WebOb-1.2.3-py2.7.egg/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 564, in __call__
    request, **action_args)
  File "/home/steveb/dev/localstack/heat/heat/common/wsgi.py", line 606, in dispatch
    return method(*args, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/util.py", line 30, in handle_stack_method
    return handler(controller, req, **kwargs)
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/stacks.py", line 294, in validate_template
    data.template())
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/stacks.py", line 99, in template
    return self.format_parse(template_data, 'Template')
  File "/home/steveb/dev/localstack/heat/heat/api/openstack/v1/stacks.py", line 66, in format_parse
    return template_format.parse(data)
  File "/home/steveb/dev/localstack/heat/heat/common/template_format.py", line 42, in parse
    tpl = yaml.safe_load(tmpl_str)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/__init__.py", line 93, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/__init__.py", line 71, in load
    return loader.get_single_data()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/constructor.py", line 37, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python2.7/site-packages/PyYAML-3.10-py2.7-linux-x86_64.egg/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
ParserError: while parsing a block mapping
  in "<unicode string>", line 5, column 5:
        Description: Name of an existing ...
        ^
expected <block end>, but found ','
  in "<unicode string>", line 7, column 19:
        MinLength: '1',
                      ^

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/34410

Changed in heat:
assignee: Steve Baker (steve-stevebaker) → Jianing YANG (jianingy)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/34410
Committed: http://github.com/openstack/heat/commit/62e173ef863d03234d05e748368446dcdf3f3daa
Submitter: Jenkins
Branch: master

commit 62e173ef863d03234d05e748368446dcdf3f3daa
Author: Jianing YANG <email address hidden>
Date: Tue Jun 25 23:55:40 2013 +0800

    Handle YAML parser error as well

    Fixes bug: #1185590
    Change-Id: Id561e2769d1f0192dd831450f10e05e8213bffa8

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: havana-2 → 2013.2
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.