Sha256: 3ae8e7eb4f4bc98f6e52f3d93f0e6f20c51f23ae9f975dbfca16424737daa5d7
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # Or use Puppet's Ruby: #!/opt/puppetlabs/puppet/bin/ruby # # Call-seq: ./inventory.rb -F form_factor=Server -v require 'motoko' require 'mcollective' include MCollective::RPC # rubocop:disable Style/MixinUsage formatter = Motoko::Formatter.new options = rpcoptions do |parser, local_options| parser.banner = "usage: #{File.basename(__FILE__)} [options]" Motoko::OptionParser.add_inventory_options(parser, formatter) parser.on('--[no-]stats', 'Display statistics') do |v| local_options[:stats] = v end Motoko::OptionParser.add_shortcut_options(parser, formatter, local_options) end options[:stats] = true if options[:stats].nil? util = rpcclient('rpcutil', options: options) util.progress = false (options[:with_class] || []).compact.each do |klass| util.class_filter(klass) end (options[:with_fact] || []).compact.each do |fact| util.fact_filter(fact) end util.inventory do |_, resp| formatter.nodes << Motoko::Node::Choria.new(resp) end puts formatter.to_s printrpcstats if options[:stats]
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
motoko-1.2.0 | exe/inventory |
motoko-1.1.0 | exe/inventory |
motoko-1.0.0 | exe/inventory |