From 25a1242c3274fe994f08587918d23cd0534e6f6b Mon Sep 17 00:00:00 2001 From: Nikolay Mahotkin Date: Fri, 11 Sep 2015 10:53:19 +0300 Subject: [PATCH] Fixing indentation in 'create action' tutorial Partially implements blueprint mistral-documentation Change-Id: I50fa230684b4ef64f7f6ae81d342d670eb5bf695 --- .../developer/creating_custom_action.rst | 61 ++++++++++--------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/doc/source/developer/creating_custom_action.rst b/doc/source/developer/creating_custom_action.rst index 0de6baa8..be2fa4aa 100644 --- a/doc/source/developer/creating_custom_action.rst +++ b/doc/source/developer/creating_custom_action.rst @@ -1,48 +1,53 @@ +============================= How to write an Action Plugin ============================= 1. Write a class inherited from mistral.actions.base.Action -:: - from mistral.actions import base + .. code-block:: python - class RunnerAction(base.Action): - def __init__(self, param): - # store the incomming params - self.param = param + from mistral.actions import base - def run(self): - # return your results here - return {'status': 0} + class RunnerAction(base.Action): + def __init__(self, param): + # store the incomming params + self.param = param -2. Publish the class in a namespace - (in your setup.cfg) + def run(self): + # return your results here + return {'status': 0} -:: - [entry_points] - mistral.actions = - example.runner = my.mistral_plugins.somefile:RunnerAction +2. Publish the class in a namespace (in your ``setup.cfg``) + + + .. code-block:: ini + + [entry_points] + mistral.actions = + example.runner = my.mistral_plugins.somefile:RunnerAction 3. Reinstall Mistral if it was installed in system (not in virtualenv). -4. Run Db-sync tool via either:: - *tools/sync_db.sh --config-file * +4. Run db-sync tool via either -or:: + .. code-block:: console - *mistral-db-manage --config-file populate* + $ tools/sync_db.sh --config-file -5. Use your plugin + or - * Now you can call the action "example.runner" + .. code-block:: console -:: + $ mistral-db-manage --config-file populate - Workflow: - tasks: - myaction: - action: example.runner - parameters: - param: avalue_to_pass_in +5. Now you can call the action ``example.runner`` + .. code-block:: yaml + + my_workflow: + tasks: + my_action_task: + action: example.runner + input: + param: avalue_to_pass_in