Permalink
Browse files

. Exceptions file at "~/.lpr-exceptions"

  • Loading branch information...
1 parent 4fe26c6 commit eeb937fa355b5d76393326cba05f292c936c2795 @kschiess committed Jan 17, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 last_puppetrun
View
@@ -2,10 +2,15 @@
require 'rubygems'
require 'active_support'
+require 'active_support/core_ext'
require 'text/highlight'
String.highlighter = Text::ANSIHighlighter.new
+# Put a list of hosts in this file that will display as yellow, not red
+# in the 'hosts that puppetd doesn't run on' list.
+EXCEPTIONS_FILE = "~/.lpr-exceptions"
+
# Run this on the puppet master as root to retrieve when puppet ran last
# on what host.
@@ -79,6 +84,11 @@ if $0 == __FILE__
runs = PuppetRuns.new
runs.parse_logfile
+ exceptions = []
+ if File.exist?(EXCEPTIONS_FILE)
+ exceptions = File.read(EXCEPTIONS_FILE).lines.map { |l| l.chomp }
+ end
+
hosts = runs.controlled_hosts
# output all hosts that have a last run time
@@ -100,6 +110,13 @@ if $0 == __FILE__
missing = (hosts - runs.last.keys)
unless missing.empty?
puts "Hosts that puppet doesn't seem to run on -(BAD!)--------------------"
+ missing.each do |name|
+ if exceptions.find { |ex_name| name =~ /^#{Regexp.escape(ex_name)}.*$/ }
+ puts name.yellow
+ else
+ puts name.red
+ end
+ end
puts missing.join("\n").red
end
end

0 comments on commit eeb937f

Please sign in to comment.