Ask Your Question

Can you associate a mistral workflow execution with an environment via the CLI?

asked 2017-04-19 13:04:13 -0500

mattybrennan gravatar image

I can create an environment, and I can create a workflow execution. But I don't see any way via the CLI to associate a workflow or a workflow execution with an environment

usage: mistral environment-create [-h] [-f {json,shell,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>]
                              [--print-empty] [--noindent]
                              [--prefix PREFIX]


usage: mistral workflow-create [-h] [-f {csv,json,table,value,yaml}]
                           [-c COLUMN] [--max-width <integer>]
                           [--print-empty] [--noindent]
                           [--quote {all,minimal,none,nonnumeric}]


usage: mistral execution-create [-h] [-f {json,shell,table,value,yaml}]
                            [-c COLUMN] [--max-width <integer>]
                            [--print-empty] [--noindent] [--prefix PREFIX]
                            [-d DESCRIPTION]
                            workflow_identifier [workflow_input] [params]
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2017-04-20 07:52:20 -0500

zaneb gravatar image

When you define an environment inline, you pass it with the "env" key as part of the [params] argument (which is in JSON format IIUC). I'm not sure how that applies to predefined environments created through the API though.

edit flag offensive delete link more


Thanks! This solves my problem.

mattybrennan gravatar imagemattybrennan ( 2017-04-25 10:58:32 -0500 )edit

It was confirmed in IRC that the following works, where my_env is the name of the predefined environment mistral execution-create $WORKFLOW '' '{"env": "my_env"}'

mattybrennan gravatar imagemattybrennan ( 2017-06-06 12:59:50 -0500 )edit

answered 2017-04-25 10:28:32 -0500

d0ugal gravatar image

updated 2017-04-26 03:06:31 -0500

I don't think there is a way to link a pre-existing environment. You could, however, have a task in the workflow that fetches the environment. This workflow takes the name of a environment, it then fetches it and outputs the contents of the environment.

    - env_name
      action: mistral.environments_get name=<% $.env_name %>
        env: task(get_env).result.variables
      on-complete: do_something
      action: std.echo output=<% $.env %>
edit flag offensive delete link more


Thanks. I guess I don't understand when the pre-existing environments are ever used then.

mattybrennan gravatar imagemattybrennan ( 2017-04-25 10:58:13 -0500 )edit

This worked me too, provided that mistral.environments_get is working. I bet d0ugal's example worked when he posted it. I ran into an issue where it didn't work for me with mistral client 3.1.0 until I applied a fix destined for 3.1.1. Details in bug: (

fultonj gravatar imagefultonj ( 2017-06-07 12:02:24 -0500 )edit

answered 2017-06-06 13:43:48 -0500

fultonj gravatar image

updated 2018-03-14 08:49:45 -0500

zaneb gravatar image

Here is a working example:

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-04-19 13:04:13 -0500

Seen: 429 times

Last updated: Mar 14 '18