Created
          November 11, 2013 16:15 
        
      - 
      
- 
        Save ploubser/7415779 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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
    
  
  
    
  | require 'mcollective' | |
| require 'pp' | |
| require 'json' | |
| # Find the config file. Right now I'm guessing | |
| # This is not going to work in the longrun. | |
| config_file = "/etc/mcollective/client.cfg" | |
| agent = ARGV[0] | |
| action = ARGV[1] | |
| # Arguments go here | |
| config = MCollective::Config.instance | |
| config.loadconfig(config_file) | |
| MCollective::PluginManager.loadclass("MCollective::Agent::#{agent.capitalize}") | |
| agent = MCollective::PluginManager.create_instance("MCollective::Agent::#{agent.capitalize}") | |
| message = {:body => {:action => action, :data => {}}} | |
| result = agent.handlemsg(message, nil) | |
| puts result[:data].to_json | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment