Class: MCollective::Runner

### Home Classes Methods

### In Files

- lib/mcollective/runner.rb

### Parent

Object

### Methods

- ::new
- #run

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::Runner

The main runner for the daemon, supports running in the foreground and the background, keeps detailed stats and provides hooks to access all this information

### Public Instance Methods

run() click to toggle source

Starts the main loop, before calling this you should initialize the MCollective::Config singleton.

    # File lib/mcollective/runner.rb, line 37
    def run
      Data.load_data_sources

      Util.subscribe(Util.make_subscriptions("mcollective", :broadcast))
      Util.subscribe(Util.make_subscriptions("mcollective", :directed)) if @config.direct_addressing

      # Start the registration plugin if interval isn't 0
      begin
        PluginManager["registration_plugin"].run(@connection) unless @config.registerinterval == 0
      rescue Exception => e
        Log.error("Failed to start registration plugin: #{e}")
      end

      loop do
        begin
          request = receive

          unless request.agent == "mcollective"
            agentmsg(request)
          else
            Log.error("Received a control message, possibly via 'mco controller' but this has been deprecated")
          end
        rescue SignalException => e
          Log.warn("Exiting after signal: #{e}")
          @connection.disconnect
          raise

        rescue MsgTTLExpired => e
          Log.warn(e)

        rescue NotTargettedAtUs => e
          Log.debug("Message does not pass filters, ignoring")

        rescue Exception => e
          Log.warn("Failed to handle message: #{e} - #{e.class}\n")
          Log.warn(e.backtrace.join("\n\t"))
        end
      end
    end

### Public Class Methods

new(configfile) click to toggle source

    # File lib/mcollective/runner.rb, line 6
    def initialize(configfile)
      @config = Config.instance
      @config.loadconfig(configfile) unless @config.configured
      @config.mode = :server

      @stats = PluginManager["global_stats"]

      @security = PluginManager["security_plugin"]
      @security.initiated_by = :node

      @connection = PluginManager["connector_plugin"]
      @connection.connect

      @agents = Agents.new

      unless Util.windows?
        Signal.trap("USR1") do
          Log.info("Reloading all agents after receiving USR1 signal")
          @agents.loadagents
        end

        Signal.trap("USR2") do
          Log.info("Cycling logging level due to USR2 signal")
          Log.cycle_level
        end
      else
        Util.setup_windows_sleeper
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.