How would I convert this program to output exactly the same thing but only
for all the (noop) operations.

We keep puppet in noop mode to audit its actions before they are applied.

Thus it is necessary to ensure we understand exactly what all the nodes
noop operations would be if we listed the noop restriction for a normal
apply.

This program will report in a reasonable format for those non-noop 
executed actions, but we want the reverse.

 

#!/usr/bin/ruby 

 

require 'puppet'

if defined?(ARGV)

   filename = ARGV.first

 

   if defined?(filename)

       report = YAML.load_file(filename)

       print "Report for : "

       puts report.host

       print "Started : "

       puts report.time

       print "Log count: "

       puts report.logs.size

       print "Metrics count: "

       puts report.metrics.size

       print "Resource Status count: "

       puts report.resource_statuses.size

       print "Status: "

       puts report.status

 

       report.logs.each do |logg|

           puts "LOG ---------------------------------------------"

           if logg.file

               print "File: "

               puts logg.file

           end

 

           if logg.line

               print "Line: "

               puts logg.line

           end

 

           print "Level: "

           puts logg.level

           print "Message: "

           puts logg.message

           print "Source: "

           puts logg.source

           print "Tags: "

           puts logg.tags.join(" ")

           print "Time: "

           puts logg.time

       end

 

       report.resource_statuses.keys.each do |kk|

           if report.resource_statuses["#{kk}"].change_count > 0

               puts "RESOURCE STATUS ===================================="

               puts "#{kk} "

               report.resource_statuses["#{kk}"].events.each do |line|

                   print "property: "

                   puts line.property

                   print "message: "

                   puts line.message

                   print "name: "

                   puts line.name

                   print "status: "

                   puts line.status

                   print "when: "

                   puts line.time

               end

           end

       end

       puts "-------------------------------------------------"

   end

end

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/da81b10c-a6e1-4e20-9f98-ad43d3038688%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to