Sha256: c53c1a672da837fa4763ee8532c3462cccea455ee26d1a4f1db0bf577812262f

Contents?: true

Size: 1.21 KB

Versions: 15

Compression:

Stored size: 1.21 KB

Contents

require 'set'

module Kafo
  module Puppet
    class ReportWrapper
      attr_reader :transaction, :report

      def initialize(transaction, report)
        @transaction     = transaction
        @report          = report
        @supported       = true
        @resources_seen  = Set.new
      end

      # Needed to fool Puppet's logging framework
      def self.to_s
        "Puppet::Transaction::Report"
      end

      def add_resource_status(status, *args, &block)
        if @supported && report.respond_to?(:resource_statuses) && report.resource_statuses.is_a?(Hash)
          if transaction.in_main_catalog && report.resource_statuses[status.resource.to_s] && transaction.tracked_resources.include?(status.resource) && !@resources_seen.include?(status.resource)
            ::Puppet.info "RESOURCE #{status.resource}"
            @resources_seen << status.resource
          end
          report.add_resource_status(status, *args, &block)
        else
          ::Puppet.err "Your puppet env is not supported, report does not define resource_statuses"
          @supported = false
        end
      end

      def method_missing(method, *args, &block)
        report.send(method, *args, &block)
      end
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kafo-1.0.4 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.8 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-1.0.3 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.7 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-1.0.2 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-1.0.1 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-1.0.0 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.6 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.5 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.4 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.3 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.2 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.1 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.9.0 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb
kafo-0.8.2 modules/kafo_configure/lib/kafo/puppet/report_wrapper.rb