Skip to content

Commit d26f6c5

Browse files
committed
Added info on tries/check_scripts to the funcworker docs.
1 parent cef174a commit d26f6c5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

workers/reworkerfunc.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,36 @@ service. This happens in lines **9** → **11**:
226226
service: megafrobber
227227
228228
229+
We can also add optional parameters ``tries`` and ``check_scripts``. ``check_scripts``
230+
is an array of scripts that will be run after the command. If they all return success
231+
(a zero return value) the whole command is considered successful. However if any
232+
return a non zero value the step is considered failed. The ``tries`` parameter tells
233+
the worker to try the step X number of times before giving up.
234+
235+
The following example will attempt the restart ``megafrobber`` and run the check_script
236+
``/usr/bin/diditwork``. If the either the restart or the check script return a failure
237+
it will try again until it's limit of 5 tries has been hit (at which point it returns
238+
failure back to the bus).
239+
240+
.. code-block:: yaml
241+
:linenos:
242+
:emphasize-lines: 12,13
243+
244+
---
245+
group: inception
246+
name: Setup megafrobber
247+
execution:
248+
- description: restart the megafrobber service
249+
hosts:
250+
- foo.bar.example.com
251+
steps:
252+
- funcworker.service:
253+
subcommand: restart
254+
service: megafrobber
255+
tries: 5
256+
check_scripts: ["/usr/bin/diditwork"]
257+
258+
229259
More Modules
230260
~~~~~~~~~~~~
231261

0 commit comments

Comments
 (0)