1
A simple helper to assist with writing MCollective actions in Python.
3
Given an action as below:
7
validate :message, String
9
implemented_by "/tmp/echo.py"
13
The following Python script will implement the echo action externally
14
replying with _message_ and _timestamp_
21
mc = mcollectiveah.MCollectiveAction()
22
mc.reply['message'] = mc.request['message']
23
mc.reply['timestamp'] = time.strftime("%c")
24
mc.reply['info'] = "some text to info log in the server"
27
Calling it with _mco rpc_ results in:
30
$ mco rpc test echo message="hello world"
31
Determining the amount of hosts matching filter for 2 seconds .... 1
33
* [ ============================================================> ] 1 / 1
37
{:message=>"hello world", :time=>"Tue Mar 15 19:20:53 +0000 2011"}