From 7ea9ad17cab2544875d4934a90522dd74f0b6396 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 20 Feb 2011 13:13:37 +0100 Subject: treat case where host is not in stored configs so far --- files/master/lastruncheck | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'files') diff --git a/files/master/lastruncheck b/files/master/lastruncheck index 420730f..babe74f 100644 --- a/files/master/lastruncheck +++ b/files/master/lastruncheck @@ -96,7 +96,9 @@ module Puppet::Lastcheck::Tests::Storedconfigs storedconfigs_hosts.each do |host| if !facts_hosts.any?{|fact_host| fact_host[:hostname] == host.name } add_failed_host(host.name, "In storedconfigs but no facts available!") - elsif host.last_compile.nil? || host.last_compile < (Time.now - @timeout) + elsif host.last_compile.nil? + add_failed_host(host.name, "No entry in storedconfigs") + elsif host.last_compile < (Time.now - @timeout) add_failed_host(host.name, "Last compile time in storedconfigs at #{host.last_compile}") end end -- cgit v1.2.3 From 84d4ee9db697e35299b5c9d157bb818af1088416 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Apr 2011 14:12:05 +0200 Subject: fix lastruncheck to be compatible for 2.6.7 --- files/master/lastruncheck | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'files') diff --git a/files/master/lastruncheck b/files/master/lastruncheck index babe74f..9eff27e 100644 --- a/files/master/lastruncheck +++ b/files/master/lastruncheck @@ -23,9 +23,11 @@ module Puppet::Lastcheck def facts_hosts return @facts_hosts if @facts_hosts require 'puppet/indirector/facts/yaml' - @facts_hosts = Puppet::Node::Facts.search("*").collect do |node| - { :hostname => node.name, :expired => node.expired?, :timestamp => node.values[:_timestamp], :expiration => node.expiration } - end + @facts_hosts = Puppet::Node::Facts.search("*").collect do |fqdn| + if node = Puppet::Node::Facts.search(fqdn) + { :hostname => node.name, :expired => node.expired?, :timestamp => node.values[:_timestamp], :expiration => node.expiration } + end + end.compact end end end -- cgit v1.2.3 From 4a5a3d04a8e45cb7666e3c270b9a3ae7a4786a70 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Apr 2011 14:39:17 +0200 Subject: find not search --- files/master/lastruncheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files') diff --git a/files/master/lastruncheck b/files/master/lastruncheck index 9eff27e..fe67d21 100644 --- a/files/master/lastruncheck +++ b/files/master/lastruncheck @@ -24,7 +24,7 @@ module Puppet::Lastcheck return @facts_hosts if @facts_hosts require 'puppet/indirector/facts/yaml' @facts_hosts = Puppet::Node::Facts.search("*").collect do |fqdn| - if node = Puppet::Node::Facts.search(fqdn) + if node = Puppet::Node::Facts.find(fqdn) { :hostname => node.name, :expired => node.expired?, :timestamp => node.values[:_timestamp], :expiration => node.expiration } end end.compact -- cgit v1.2.3 From 05a9d526ab7a23dea30058dbb3ac21a9bb521dab Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Apr 2011 17:21:52 +0200 Subject: no need to log to the console as we don't use puppets logging feature --- files/master/lastruncheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files') diff --git a/files/master/lastruncheck b/files/master/lastruncheck index fe67d21..149c655 100644 --- a/files/master/lastruncheck +++ b/files/master/lastruncheck @@ -189,7 +189,7 @@ class Puppet::Application::Lastcheck < Puppet::Application def setup exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? - Puppet::Util::Log.newdestination :console + #Puppet::Util::Log.newdestination :console Puppet::Node::Facts.terminus_class = :yaml Puppet::Lastcheck::Tests.tests.keys.each do |test| -- cgit v1.2.3