Class | MCollective::Application::Facts |
In: |
plugins/mcollective/application/facts.rb
|
Parent: | MCollective::Application |
# File plugins/mcollective/application/facts.rb, line 30 30: def main 31: rpcutil = rpcclient("rpcutil") 32: rpcutil.progress = false 33: 34: facts = {} 35: 36: rpcutil.get_fact(:fact => configuration[:fact]) do |resp| 37: begin 38: value = resp[:body][:data][:value] 39: if value 40: facts.include?(value) ? facts[value] << resp[:senderid] : facts[value] = [ resp[:senderid] ] 41: end 42: rescue Exception => e 43: STDERR.puts "Could not parse facts for #{resp[:senderid]}: #{e.class}: #{e}" 44: end 45: end 46: 47: show_single_fact_report(configuration[:fact], facts, options[:verbose]) 48: 49: printrpcstats 50: end
# File plugins/mcollective/application/facts.rb, line 4 4: def post_option_parser(configuration) 5: configuration[:fact] = ARGV.shift if ARGV.size > 0 6: end
# File plugins/mcollective/application/facts.rb, line 12 12: def show_single_fact_report(fact, facts, verbose=false) 13: puts("Report for fact: #{fact}\n\n") 14: 15: facts.keys.sort.each do |k| 16: printf(" %-40sfound %d times\n", k, facts[k].size) 17: 18: if verbose 19: puts 20: 21: facts[k].sort.each do |f| 22: puts(" #{f}") 23: end 24: 25: puts 26: end 27: end 28: end