summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-08-07 01:31:17 +0200
committermh <mh@immerda.ch>2010-08-07 01:33:12 +0200
commit7df4eabf27357731cbdf6946591df92ac15e8ed2 (patch)
tree0a64fdb341d4d239a56b82bd3e8555dd41a76aba /files
parent55c61cf9ab8752663bdce0604ca4d7ef6647142f (diff)
improve checklastrun script
Diffstat (limited to 'files')
-rw-r--r--files/master/puppetlast12
1 files changed, 11 insertions, 1 deletions
diff --git a/files/master/puppetlast b/files/master/puppetlast
index 752d6ca..0f6c0cc 100644
--- a/files/master/puppetlast
+++ b/files/master/puppetlast
@@ -12,6 +12,16 @@ Puppet.parse_config
Puppet[:name] = "puppetmasterd"
Puppet::Node::Facts.terminus_class = :yaml
+all = false
+timeout = 120
+ARGV.each do |arg|
+ if arg.to_s == '--all'
+ all = true
+ else
+ timeout = arg.to_i
+ end
+end
+
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 - 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'))
+ 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 > timeout or all)
end