In case of simplified parameter syntax expressions are not always evaluated properly

Bug #1396461 reported by Renat Akhmerov
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Medium
Unassigned

Bug Description

If we use something like

action: my_action param="{$.my_var}.example.com"

then the expression doesn't get evaluated properly.

If we use the same with "input" section then it works.

Revision history for this message
Anastasia Kuznetsova (akuznetsova) wrote :

I can't reproduce this bug.
Step to verify:
1. Write a simple workflow:
wf1:
  type: reverse
  input:
    - farewell
  tasks:
    addressee:
      action: std.echo output="John"
      publish:
        name: $
    goodbye:
      action: std.echo output="{$.farewell}, {$.name}"
      requires: [addressee]
2. Create this wf using CLI and run execution with needed inputs and params.
3. Got "Task 'goodbye' [RUNNING -> SUCCESS, result = bye, John]"

Changed in mistral:
status: New → Incomplete
Revision history for this message
Dmitri Zimine (i-dz) wrote :

Try to change this to action: std.echo output="{$.farewell}.Anastasia"

I think it's a dot '.' that throws it over.

Revision history for this message
Anastasia Kuznetsova (akuznetsova) wrote :

Agreed, in case of for example such input:
{
    "names_info": [
        {"name": "John"},
        {"name": "Ivan"},
        {"name": "Mistral"}
    ]
}
I've got: Task 'task1' [RUNNING -> SUCCESS, result = Hello, {$.name_info.name}!]

Changed in mistral:
status: Incomplete → Confirmed
importance: Undecided → Medium
Revision history for this message
Renat Akhmerov (rakhmerov) wrote :

$.name_info.name should not work because you provide an array. If you try $.name_info[0] then it must work. What Dmitri said is that a dot (".") in expressions makes difference even when we don't provide arrays as an input.

Revision history for this message
Anastasia Kuznetsova (akuznetsova) wrote :

Sorry for misunderstanding.

I tried again:
1) created workflow:
version: 2.0

wf1:
  type: reverse
  input:
    - farewell
  tasks:
    addressee:
      action: std.echo output="John"
      publish:
        name: $
    goodbye:
      action: std.echo output="{$.farewell}.Anastasia and {$.name}"
      requires: [addressee]

2) run execution with following input :
{
    "farewell": "Bye"
}
and start task:
{
    "task_name": "goodbye"
}
3) got:
2014-12-10 11:38:03.122 4383 INFO workflow_trace [-] Task 'goodbye' [RUNNING -> SUCCESS, result = Bye.Anastasia and John]
2014-12-10 11:38:03.128 4383 INFO workflow_trace [-] Execution of workflow 'wf1' [RUNNING -> SUCCESS]

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/140865

Changed in mistral:
status: Confirmed → In Progress
Revision history for this message
Renat Akhmerov (rakhmerov) wrote :

So it does not get reproduced, right? Looks like also the test added by Lakshmi proves that as well. Can we close the ticket?

Revision history for this message
Anastasia Kuznetsova (akuznetsova) wrote :

I guess that we can.

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

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

commit d8e4f1b95befb7ee1069a4a13b196c4c2a95c10a
Author: Lakshmi Kannan <email address hidden>
Date: Wed Dec 10 15:19:34 2014 -0800

    Add test case for dataflow to test action input

      Closes-Bug: 1396461

      Description:

        * Action input specified inline should work with dots.
          For example, action: std.echo output="{$.farewell}.Amigo"
        * Amended test case in dataflow tests to account for above.

    Change-Id: Ie78273854d8bcbca5033266f98ce53e7544dd61f

Changed in mistral:
status: Invalid → Fix Committed
Changed in mistral:
milestone: none → kilo-3
importance: Undecided → Medium
Changed in mistral:
status: Fix Committed → Fix Released
Changed in mistral:
milestone: kilo-3 → 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.