Class: MCollective::Application::Find

Inherits:
MCollective::Application show all
Defined in:
lib/mcollective/application/find.rb

Instance Method Summary collapse

Methods inherited from MCollective::Application

[], []=, #application_cli_arguments, #application_description, #application_failure, #application_options, application_options, #application_parse_options, #application_usage, #clioptions, #configuration, description, #disconnect, exclude_argument_sections, #halt, #halt_code, #help, intialize_application_options, option, #options, #rpcclient, #run, usage, #validate_cli_options, #validate_option

Methods included from RPC

const_missing, discovered, #empty_filter?, #printrpc, #printrpcstats, #rpcclient, #rpcoptions, stats

Instance Method Details

#mainObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mcollective/application/find.rb', line 4

def main
  mc = rpcclient("rpcutil")

  starttime = Time.now

  nodes = mc.discover

  discoverytime = Time.now - starttime

  STDERR.puts if options[:verbose]

  nodes.each {|c| puts c}

  STDERR.puts "\nDiscovered %s nodes in %.2f seconds using the %s discovery plugin" % [nodes.size, discoverytime, mc.client.discoverer.discovery_method] if options[:verbose]

  nodes.size > 0 ? exit(0) : exit(1)
end