# File lib/mcollective/application/inventory.rb, line 291
  def formatted_inventory(&blk)
    require 'formatr'

    raise "Need to give a block to formatted_inventory" unless block_given?

    blk.call if block_given?

    raise "Need to define page body format" if @page_body.nil?

    body_fmt = FormatR::Format.new(@page_heading, @page_body)
    body_fmt.setPageLength(@page_length)
    time = Time.now

    util = rpcclient("rpcutil")
    util.progress = false

    util.inventory do |t, resp|
      @node = {:identity => resp[:sender],
        :facts    => resp[:data][:facts],
        :classes  => resp[:data][:classes],
        :agents   => resp[:data][:agents]}

      body_fmt.printFormat(binding)
    end
  rescue Exception => e
    STDERR.puts "Could not create report: #{e.class}: #{e}"
    exit 1
  end