Executing python script using Mcollective
All,
I have a demo MCollective environment ( https://github.com/ripienaar/mcollect... ) on which I am trying to create an agent plugin that runs a simple python script:
#!/usr/bin/python
print "Hello, World!"
Here is the plugin code:
module MCollective
module Agent
class Testpy<RPC::Agent
# Basic echo server
action "echo" do
implemented_by "testpy.py"
end
end
end
end
and the DDL (which is same as the helloworld plugin from puppetlabs)
metadata :name => "echo",
:description => "Echo service for MCollective",
:author => "R.I.Pienaar",
:license => "GPLv2",
:version => "1.1",
:url => "http://projects.puppetlabs.com/projects/mcollective-pl
ugins/wiki",
:timeout => 60
action "echo", :description => "Echos back any message it receives" do
input :msg,
:prompt => "Service Name",
:description => "The service to get the status for",
:type => :string,
:validation => '^[a-zA-Z\-_\d]+$',
:optional => false,
:maxlength => 30
output :msg,
:description => "The message we received",
:display_as => "Message"
end
However, I get the below error when running the plugin
[vagrant@middleware vagrant]$ mco rpc -v --display=all testpy echo msg="hellowo
rld"
Discovering hosts using the redis method .... 1
* [ ==========================================================> ] 1 / 1
middleware.example.net : Unexpected failure calling testpy.py:
MCollective::RPCAborted: Cannot execute testpy#echo command: testpy.py
{:msg=>nil}
---- testpy#echo call stats ----
Nodes: 1 / 1
Pass / Fail: 0 / 1
Start Time: Fri Sep 12 19:47:15 +0000 2014
Discovery Time: 4.15ms
Agent Time: 10.63ms
Total Time: 14.78ms
Can you please help? If the above method is not the right/best one to run a python script using mcollecitve, please suggest me one. Thanks