mistral/doc/source/contributor/creating_custom_action.rst
csatari a7cd611c78 Applying Pike document structure
This change aligns the Mistral documents folder structure to
the one specified for Pike [1].
Documents were move to thir appropriate folder, but the different
guides do not follow their cookie cutted structure yet.
Install guide is in a separate change [2], while I could not
found the cookie cutter for the rest of the guides.

test-requirements.txt updated with the missing modules.

tox_install.sh modified to do not pass $MODULE_NAME and -e parameter to
edit-constraints.

[1]: http://specs.openstack.org/openstack/docs-specs/specs/pike/os-manuals-migration.html
[2]: https://review.openstack.org/#/c/476499/
[3]: https://etherpad.openstack.org/p/doc-migration-tracking

Change-Id: Ia1101fa2eada446d8eebfefa9bd15d8facd8b3b0
Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454
Signed-off-by: csatari <gergely.csatari@nokia.com>
2017-07-11 09:24:17 +02:00

1.1 KiB

How to write a Custom Action

  1. Write a class inherited from mistral.actions.base.Action
from mistral.actions import base

class RunnerAction(base.Action):
    def __init__(self, param):
        # store the incoming params
        self.param = param

    def run(self):
        # return your results here
        return {'status': 0}
  1. Publish the class in a namespace (in your setup.cfg)
[entry_points]
mistral.actions =
    example.runner = my.mistral_plugins.somefile:RunnerAction
  1. Reinstall Mistral if it was installed in system (not in virtualenv).
  2. Run db-sync tool via either
$ tools/sync_db.sh --config-file <path-to-config>

or

$ mistral-db-manage --config-file <path-to-config> populate
  1. Now you can call the action example.runner
my_workflow:
  tasks:
    my_action_task:
      action: example.runner
      input:
        param: avalue_to_pass_in