Skip to content

workflows fail when calling mistral from action-chain #3440

@AndyMoore111

Description

@AndyMoore111

when calling a mistral workflow from an action-chain workflow stackstorm misinterprets the variables as jinja and fails

this happens on 2.2.1 and 2.1.1

steps to reproduce:

---
  name: "ac"
  runner_type: "action-chain"
  description: "actest"
  enabled: true
  entry_point: "workflows/ac.yaml"
  pack: "bitesize"
  parameters:
    var1:
      type: "string"
[11:17] root@ip-10-1-1-39:/opt/stackstorm/packs/bitesize/actions# cat workflows/ac.yaml 
---
  chain:
    -
      name: "mst1"
      ref: "bitesize.mst1"
      params:
        var1: "{{var1}}"
[11:17] root@ip-10-1-1-39:/opt/stackstorm/packs/bitesize/actions# cat mst1.meta.yaml 
---
  name: "mst1"
  runner_type: "mistral-v2"
  enabled: true
  entry_point: "workflows/mst1.yaml"
  pack: "bitesize"
  parameters:
    var1:
      type: "string"
[11:17] root@ip-10-1-1-39:/opt/stackstorm/packs/bitesize/actions# cat workflows/mst1.yaml 
version: '2.0'
bitesize.mst1:
  type: direct
  input:
    - var1
  tasks:
    run_cmd:
      action: core.local
      input:
        cmd: "echo <% $.var1 %>"
[11:17] root@ip-10-1-1-39:/opt/stackstorm/packs/bitesize/actions# st2 action execute bitesize.ac var1=andy
To get the results, execute:
 st2 execution get 592ea67316fa2948e922f5c2
[11:18] root@ip-10-1-1-39:/opt/stackstorm/packs/bitesize/actions#  st2 execution get 592ea67316fa2948e922f5c2
id: 592ea67316fa2948e922f5c2
action.ref: bitesize.ac
parameters: 
  var1: andy
status: failed (2s elapsed)
start_timestamp: 2017-05-31T11:18:11.721288Z
end_timestamp: 2017-05-31T11:18:13.005844Z
+--------------------------+---------------------+------+---------------+-------------------------------+
| id                       | status              | task | action        | start_timestamp               |
+--------------------------+---------------------+------+---------------+-------------------------------+
| 592ea67316fa2944205baca0 | failed (1s elapsed) | mst1 | bitesize.mst1 | Wed, 31 May 2017 11:18:11 UTC |
+--------------------------+---------------------+------+---------------+-------------------------------+
[11:18] root@ip-10-1-1-39:/opt/stackstorm/packs/bitesize/actions#  st2 execution get 592ea67316fa2944205baca0 -dj
{
    "action": {
        "ref": "bitesize.mst1"
    }, 
    "context": {
        "user": "st2admin"
    }, 
    "end_timestamp": "2017-05-31T11:18:12.143507Z", 
    "id": "592ea67316fa2944205baca0", 
    "liveaction": {
        "action": "bitesize.mst1", 
        "action_is_workflow": true, 
        "callback": {}, 
        "id": "592ea67316fa2944205bac9f", 
        "parameters": {
            "var1": "andy"
        }, 
        "runner_info": {
            "hostname": "ip-10-1-1-39", 
            "pid": 17437
        }
    }, 
    "parameters": {
        "var1": "andy"
    }, 
    "result": {
        "error": "Can not evaluate Jinja expression [expression=var1, error='var1' is undefined, data={'__env': {u'st2_liveaction_id': u'592ea67316fa2944205bac9f', u'st2_execution_id': u'592ea67316fa2944205baca0', u'__actions': {u'st2.action': {u'st2_context': {u'endpoint': u'http://0.0.0.0:9101/v1/actionexecutions', u'api_url': u'http://0.0.0.0:9101/v1', u'parent': {u'chain': {u'name': u'mst1', u'parameters': None, u'publish': None, u'params': {u'var1': u'{{var1}}'}, u'notify': None, u'on_failure': None, u'ref': u'bitesize.mst1', u'on_success': None}, u'parent': {u'user': u'st2admin', u'execution_id': u'592ea67316fa2948e922f5c2'}, u'execution_id': u'592ea67316fa2944205baca0', u'user': u'st2admin'}, u'auth_token': u'0913fc5c9c7941f29e0b89148a357589', u'skip_notify_tasks': [], u'notify': {}}}}, u'st2_action_api_url': u'http://0.0.0.0:9101/v1'}}]", 
        "traceback": "  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2actions/container/base.py\", line 99, in _do_run\n    (status, result, context) = runner.run(action_params)\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/retrying.py\", line 49, in wrapped_f\n    return Retrying(*dargs, **dkw).call(f, *args, **kw)\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/retrying.py\", line 206, in call\n    return attempt.get(self._wrap_exception)\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/retrying.py\", line 247, in get\n    six.reraise(self.value[0], self.value[1], self.value[2])\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/retrying.py\", line 200, in call\n    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)\n  File \"/opt/stackstorm/runners/mistral_v2/mistral_v2.py\", line 218, in run\n    result = self.start(action_parameters=action_parameters)\n  File \"/opt/stackstorm/runners/mistral_v2/mistral_v2.py\", line 260, in start\n    **options)\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/mistralclient/api/v2/executions.py\", line 56, in create\n    return self._create('/executions', data)\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/mistralclient/api/base.py\", line 95, in _create\n    self._raise_api_exception(resp)\n  File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/mistralclient/api/base.py\", line 143, in _raise_api_exception\n    error_message=error_data)\n"
    }, 
    "start_timestamp": "2017-05-31T11:18:11.906803Z", 
    "status": "failed"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions