Mistral 客户端命令指南

Mistral CLI 可以使用 mistral 命令或通过 openstack 使用。

安装

要通过 pip 安装 mistralopenstack

$ pip install python-mistralclient python-openstackclient

有关 OpenStackClient 的更多信息,请参见此处。

Mistral 客户端

学习所有命令和预期参数的最佳方法是使用 mistral help 命令。

$ mistral help
usage: mistral [--version] [-v] [--log-file LOG_FILE] [-q] [-h] [--debug]
               [--os-mistral-url MISTRAL_URL]
               [--os-mistral-version MISTRAL_VERSION]
               [--os-mistral-service-type SERVICE_TYPE]
...

它也可以与子命令的名称一起使用。

$ mistral help execution-create
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]

Create new execution.

positional arguments:
  workflow_identifier   Workflow ID or name. Workflow name will be deprecated
                        since Mitaka.
...

OpenStack 客户端

OpenStack 客户端的工作方式类似,命令 openstack help 显示所有可用命令,然后 openstack help <子命令> 将显示详细用法。

可以使用 openstack command list 列出已在 OpenStack 客户端中注册的完整 Mistral 命令列表。默认情况下,它将分组列出所有命令,但我们可以指定仅 Mistral 命令组。

$ openstack command list --group openstack.workflow_engine.v2
+------------------------------+-----------------------------------+
| Command Group                | Commands                          |
+------------------------------+-----------------------------------+
| openstack.workflow_engine.v2 | action definition create          |
|                              | action definition show |
|                              | action definition delete          |
|                              | action definition list            |
|                              | action definition show            |
|                              | action definition update          |
|                              | action execution delete           |
...

然后可以为单个命令请求详细的帮助输出。

$ openstack help workflow execution create
usage: openstack workflow 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]

Create new execution.

positional arguments:
  workflow_identifier   Workflow ID or name. Workflow name will be deprecated
                        since Mitaka.
  workflow_input        Workflow input
  params                Workflow additional parameters