Created
March 25, 2011 09:37
-
-
Save phrawzty/886613 to your computer and use it in GitHub Desktop.
An MCollective agent to hot-reload MCollective agents (simple RPC-style)
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 agentreload<RPC::Agent | |
action 'reload' do | |
reload | |
end | |
private | |
def reload | |
if request[:name] | |
agent = request[:name] | |
else | |
reply.fail! 'Must specify an agent name (passed as argument, name=<agent>' | |
end | |
libdir = config.send('libdir') | |
file = "#{libdir}/mcollective/agent/#{agent}" | |
reply.fail! "#{file} not found." unless File.exist?(file) | |
load(file) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment