posting incorrect workflow/workbook results in 500 server error

Bug #1414921 reported by Dmitri Zimine
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Medium
Nikolay Makhotkin

Bug Description

Expected result - client error 400, and return the details on the error
Actual result: 500 (and python-mistralclient handles it by saying "A server error occurred. Please contact the administrator."

LOG for workflow, but same happens for syntax error in workbook:

2015-01-26 23:33:51.681 14849 INFO mistral.api.controllers.v2.workflow [-] Create workflow(s) [definition=--
version: "2.0"
name: simple_workflow
description: Simple workflow without a workbook

type: direct

tasks:
  do_nothing_task:
    description: do nothing
    policies:
      wait-before: 1
    action: std.echo
    input:
      output:
        key1: "bar"
        key2: [foo, bar]
    publish:
      result: $]
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.7_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/dzimine/Dev/openstack/mistral/.tox/py27/lib/python2.7/site-packages/pecan/middleware/recursive.py", line 56, in __call__
    return self.application(environ, start_response)
  File "/Users/dzimine/Dev/openstack/mistral/.tox/py27/lib/python2.7/site-packages/pecan/core.py", line 812, in __call__
    return super(Pecan, self).__call__(environ, start_response)
  File "/Users/dzimine/Dev/openstack/mistral/.tox/py27/lib/python2.7/site-packages/pecan/core.py", line 661, in __call__
    self.invoke_controller(controller, args, kwargs, state)
  File "/Users/dzimine/Dev/openstack/mistral/.tox/py27/lib/python2.7/site-packages/pecan/core.py", line 561, in invoke_controller
    result = controller(*args, **kwargs)
  File "/Users/dzimine/Dev/openstack/mistral/mistral/utils/rest_utils.py", line 48, in wrapped
    return func(*args, **kwargs)
  File "/Users/dzimine/Dev/openstack/mistral/mistral/api/controllers/v2/workflow.py", line 134, in post
    db_wfs = workflows.create_workflows(definition)
  File "/Users/dzimine/Dev/openstack/mistral/mistral/services/workflows.py", line 36, in create_workflows
    wf_list_spec = spec_parser.get_workflow_list_spec_from_yaml(definition)
  File "/Users/dzimine/Dev/openstack/mistral/mistral/workbook/parser.py", line 128, in get_workflow_list_spec_from_yaml
    spec_dict = parse_yaml(text)
  File "/Users/dzimine/Dev/openstack/mistral/mistral/workbook/parser.py", line 45, in parse_yaml
    raise RuntimeError("Definition could not be parsed: %s\n" % e)
RuntimeError: Definition could not be parsed: mapping values are not allowed here
  in "<unicode string>", line 2, column 8:
    version: "2.0"
           ^

127.0.0.1 - - [26/Jan/2015 23:33:51] "POST /v2/workflows HTTP/1.1" 500 59

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

The problem is those two dashes on the top of definition:

--
version: 2.0

...

YAQL marker - three dashes. Ok, I fix this bug.

Changed in mistral:
assignee: nobody → Nikolay Makhotkin (nmakhotkin)
milestone: none → kilo-2
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

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

Changed in mistral:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/150364
Committed: https://git.openstack.org/cgit/stackforge/mistral/commit/?id=f636676b47e8f89f4c7f4c684cc385c582d52a62
Submitter: Jenkins
Branch: master

commit f636676b47e8f89f4c7f4c684cc385c582d52a62
Author: Nikolay Mahotkin <email address hidden>
Date: Tue Jan 27 13:51:51 2015 +0300

    Fix 500 error on wrong definition

    Closes-Bug: #1414921

    Change-Id: I959e487006dee794ce74aa944291564a2c668b67

Changed in mistral:
status: In Progress → Fix Committed
Changed in mistral:
status: Fix Committed → Fix Released
Changed in mistral:
milestone: kilo-2 → 2015.1
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.