deb-mistral/doc/source/developer/writing_a_plugin_action.rst
Dmitri Zimine e328238c4c Add documentation - part 1
Setup structure and clean-up docs 

Coming up next: 

* TODO: migrate DSL specs from wiki
* TODO: setup autodocs to for REST v2

Change-Id: Ia15a65a2909bd71821c8a6e94b3f9470ee6145d5
2014-10-05 12:56:37 -07:00

723 B

How to write an Action Plugin

1. Write a class based on mistral.actions.base.Actions :

from mistral.actions import base

class RunnerAction(base.Action):
   def __init__(self, param):
       # store the incomming 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. Use your plugin
  • Now you can call the action "example.runner"
Workflow:
  tasks:
    myaction:
      action: example.runner
      parameters:
        param: avalue_to_pass_in