YAQL raises error if it gets '{some text}' as expression

Bug #1415886 reported by Nikolay Makhotkin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Unassigned

Bug Description

Steps to reproduce:

1. Create workflow and provide input to task something like '{assd}':

---
version: "2.0"
wf22:
  type: direct
  tasks:
    task1:
      action: std.echo output="{some text}"

2. Type mistral execution-create wf22

3. Get YaqlGrammarError or YaqlLexicalException:

http://paste.openstack.org/show/163632/
or
http://paste.openstack.org/show/163630/

Suggested solution: We should return the same string we get in YAQLEvaluator.

Revision history for this message
Dmitri Zimine (i-dz) wrote :

hm...
but what if the string is fat-fingered yaql expression? what indicates that it is a string?

Revision history for this message
Dmitri Zimine (i-dz) wrote :

After thinking about it more:

{'this should work'} but {this should fail}.

1) in the first case, user wants to pass a string and explicitly stating that it's a string. It's a question why anyone would do so, but
2) in the second case, how system tells apart an intention to pass a string from fat-fingered yaql? {lenght(4)} is this a string or a mistyped function call? The YAQL exception in place is a better behavior than resolving it to the string to fail few steps down.

at the risk of restating the obvious: Fail Fast

* http://www.practical-programming.org/articles/fail_fast_principle/fail_fast_principle.html
* http://www.martinfowler.com/ieeeSoftware/failFast.pdf

Revision history for this message
Renat Akhmerov (rakhmerov) wrote :

 hm.., yes, 1) doesn't make any sense but you're right it's up to them. We just need to have clear simple rules about this.

As far as 2) I think we should just raise an exception. Agree on 'fail-fast'.

So overall, 1) rule seems to be enough.

Revision history for this message
Renat Akhmerov (rakhmerov) wrote :

So I think this behavior is not a but and propse to close it.

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

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

commit 6a2481c6c6de0274d8784477b6719f4d05054ab0
Author: Dmitri Zimine <email address hidden>
Date: Sun Feb 1 16:12:47 2015 -0800

    Catch workflow errors

    Avoid keeping workflow in zombie state: on unexpected errors
    fail the workflow execution and save error information. If possible,
    fail the correspondent tasks, too.

    Done:
    - [x] Introduce state_info into Execution, fill it with error info
    when workflow fails.
    - [x] Add error handlers to `on_task_result` and `run_task`
    - [x] Add error handlers and tests to `start_workflow`
    - [x] Add tests for YAQL eval exceptions
    - [x] Add error handler and tests to `resume_worklfow`

    TODO:
    - [ ] Make _fail_workflow public and let user fail workflow via API
    (on separate commit)

    Closes-bug: 1415886
    Change-Id: Ib1fd661580d3a426dbbc7401a3622a98c7840e00

Changed in mistral:
status: Confirmed → 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.