lib/puppet/reports/tagmail.rb
# Process the report.  This just calls the other associated messages.
Process the report.  This just calls the other associated messages.
Process the report . This just calls the other associated messages .
def process(tagmail_conf_file = (Puppet[:confdir] + '/tagmail.conf'))
    unless Puppet::FileSystem.exist?(tagmail_conf_file)
      Puppet.notice "Cannot send tagmail report; no tagmap file #{tagmail_conf_file}"
      return
    end
    metrics = begin
                raw_summary || {}
              rescue StandardError
                {}
              end
    metrics['resources'] = begin
                             metrics['resources'] || {}
                           rescue StandardError
                             {}
                           end
    metrics['events'] = begin
                          metrics['events'] || {}
                        rescue StandardError
                          {}
                        end
    logs_err = logs.index { |x| x.level.to_s == 'err' }
    if logs_err.nil? && metrics['resources']['out_of_sync'] == 0 && metrics['resources']['changed'] == 0 && metrics['events']['audit'].nil?
      Puppet.notice 'Not sending tagmail report; no changes'
      return
    end
    taglists = parse(File.read(tagmail_conf_file))
    reports = match(taglists)
    reports.reject! { |item| item =~ %r{Applied\ catalog\ in\ .*\ seconds} }
    send(reports) unless reports.empty?
  end
def process ( tagmail_conf_file = ( Puppet [ :confdir ] + '/tagmail.conf' ) ) unless Puppet :: FileSystem . exist? ( tagmail_conf_file ) Puppet . notice "Cannot send tagmail report; no tagmap file #{tagmail_conf_file}" return end metrics = begin raw_summary || { } rescue StandardError { } end metrics [ 'resources' ] = begin metrics [ 'resources' ] || { } rescue StandardError { } end metrics [ 'events' ] = begin metrics [ 'events' ] || { } rescue StandardError { } end logs_err = logs . index { | x | x . level . to_s == 'err' } if logs_err . nil? && metrics [ 'resources' ] [ 'out_of_sync' ] == 0 && metrics [ 'resources' ] [ 'changed' ] == 0 && metrics [ 'events' ] [ 'audit' ] . nil? Puppet . notice 'Not sending tagmail report; no changes' return end taglists = parse ( File . read ( tagmail_conf_file ) ) reports = match ( taglists ) reports . reject! { | item | item =~ %r{ Applied \  catalog \  in \  .* \  seconds } } send ( reports ) unless reports . empty? end
Process the report.
Process the report .
# Check for 'err' level logs, which indicates failed catalog # Altering to "(metrics['resources']['out_of_sync'] ).zero?" from "metrics['resources']['out_of_sync'] == 0" as causes tests to fail due to 'nil:NilClass' errors. # Now find any appropriately tagged messages.
tagmail_conf_file
<not_specific>