Skip to content

Instantly share code, notes, and snippets.

@phrawzty
Created March 25, 2011 09:37
Show Gist options
  • Save phrawzty/886613 to your computer and use it in GitHub Desktop.
Save phrawzty/886613 to your computer and use it in GitHub Desktop.
An MCollective agent to hot-reload MCollective agents (simple RPC-style)
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