From 2efa9ee240ccce9e7baf8e442972cdbc932ac0c1 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 2 Nov 2009 00:18:46 +0100 Subject: parse the timestamps before substracting them --- files/master/puppetlast | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'files') diff --git a/files/master/puppetlast b/files/master/puppetlast index 99a760e..752d6ca 100644 --- a/files/master/puppetlast +++ b/files/master/puppetlast @@ -5,6 +5,7 @@ # changed by admin+puppet(at)immerda.ch to fit our needs # require 'puppet' +require 'time' Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config @@ -12,5 +13,5 @@ Puppet[:name] = "puppetmasterd" Puppet::Node::Facts.terminus_class = :yaml Puppet::Node::Facts.search("*").sort { |a,b| a.name <=> b.name }.each do |node| - puts "#{node.name} #{node.expired? ? 'cached expired, ' : ''}last checked #{((Time.now - node.values[:_timestamp]) / 60).floor} minutes ago" if (((Time.now - node.values[:_timestamp]) / 60).floor > 60 or (not ARGV[0].nil? and ARGV[0].to_s == '--all')) + puts "#{node.name} #{node.expired? ? 'cached expired, ' : ''}last checked #{((Time.now - Time.parse(node.values[:_timestamp])) / 60).floor} minutes ago" if (((Time.now - Time.parse(node.values[:_timestamp])) / 60).floor > 120 or (not ARGV[0].nil? and ARGV[0].to_s == '--all')) end -- cgit v1.2.3