Created
May 22, 2014 13:27
-
-
Save xcu/509525c9e87e3ae5e180 to your computer and use it in GitHub Desktop.
Sample agent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metadata :name => "exampleagent", | |
:description => "Example agent that serves as an example", | |
:author => "Julio Iglesias", | |
:license => "Ericcson", | |
:version => "1.0", | |
:url => "http://badgerbadgerbadger.com", | |
:timeout => 10 | |
action "serve_as_example", :description => "Be an illustration how to create an agent" do | |
display :always | |
input :echo_string, | |
:prompt => "String to echo", | |
:description => "String to echo", | |
:type => :string, | |
:validation => '^.+$', | |
:optional => false, | |
:maxlength => 300 | |
output :status, | |
:description => "The output of the command", | |
:display_as => "Command result", | |
:default => "no output" | |
summarize do | |
aggregate summary(:status) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MCollective | |
module Agent | |
class Exampleagent<RPC::Agent | |
# Basic echo example | |
action "serve_as_example" do | |
cmd = "echo \"#{request[:echo_string]}\" " | |
reply[:status] = run("#{cmd}", | |
:stdout => :out, | |
:stderr => :err, | |
:chomp => true) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment