Skip to content

Instantly share code, notes, and snippets.

@binford2k
Created August 1, 2013 20:50
Show Gist options
  • Save binford2k/6135160 to your computer and use it in GitHub Desktop.
Save binford2k/6135160 to your computer and use it in GitHub Desktop.
simple mco agent
module MCollective
module Agent
class Netserv<RPC::Agent
metadata :name => "netserv",
:description => "Network services for MCollective",
:author => "Ben Ford",
:license => "GPLv2",
:version => "1.1",
:url => "http://www.puppetlabs.com.com/education",
:timeout => 60
# Basic motd server
action "motd" do
reply[:msg] = File.read('/etc/motd')
end
action "finger" do
validate :user, String
plan = "/home/#{request[:user]}/.plan"
reply.fail "No .plan file for user" unless File.exists?(plan)
# check all the validation(s) passed before doing any work
return unless reply.statuscode == 0
reply[:msg] = File.read(plan)
end
end
end
end
@binford2k
Copy link
Author

In current mco, you'd omit the metadata hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment