Created
March 8, 2011 15:26
-
-
Save ripienaar/860404 to your computer and use it in GitHub Desktop.
script to test the filemgr agent standalone without requiring mcollective to run
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
#!/usr/bin/ruby | |
require 'mcollective' | |
require 'pp' | |
configfile = "server.cfg" | |
agent = "filemgr" | |
request = {:action => "status", | |
:data => {:file => "/tmp"}} | |
classname = "MCollective::Agent::#{agent.capitalize}" | |
class NoopConnector | |
def method_missing(*args) | |
MCollective::Log.debug("connector #{args.pretty_inspect}") | |
true | |
end | |
end | |
# stub the connector with a noop one | |
MCollective::PluginManager << {:type => "connector_plugin", :class => "NoopConnector"} | |
connection = MCollective::PluginManager["connector_plugin"] | |
config = MCollective::Config.instance | |
config.loadconfig(configfile) unless config.configured | |
MCollective::PluginManager.loadclass(classname) | |
MCollective::PluginManager << {:type => "#{agent}_agent", :class => classname} | |
pp MCollective::PluginManager["#{agent}_agent"].handlemsg({:body => request}, connection) |
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
debug 2011/03/08 15:26:21: ddl.rb:56:in `findddlfile' Found filemgr ddl at /usr/libexec/mcollective/mcollective/agent/filemgr.ddl | |
debug 2011/03/08 15:26:21: pluginmanager.rb:73:in `[]' Returning plugin filemgr_agent with class MCollective::Agent::Filemgr | |
debug 2011/03/08 15:26:21: filemgr.rb:63:in `status' Asked for status of '/tmp' - it is present | |
{:statusmsg=>"OK", | |
:data=> | |
{:ctime=>Tue Mar 08 15:07:57 +0000 2011, | |
:type=>"directory", | |
:present=>1, | |
:uid=>0, | |
:mtime_seconds=>1299596877, | |
:gid=>0, | |
:ctime_seconds=>1299596877, | |
:atime_seconds=>1299529385, | |
:atime=>Mon Mar 07 20:23:05 +0000 2011, | |
:size=>4096, | |
:output=>"present", | |
:name=>"/tmp", | |
:md5=>0, | |
:mtime=>Tue Mar 08 15:07:57 +0000 2011, | |
:mode=>"41777"}, | |
:statuscode=>0} |
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
libdir = /usr/libexec/mcollective | |
loglevel = debug | |
logger_type = console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to run an mcollective agent without the middleware, daemons etc, little thing to help with development and debug