summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAJ Christensen <aj@junglist.gen.nz>2008-07-30 11:36:43 +1200
committerJames Turnbull <james@lovedthanlost.net>2008-08-01 07:09:33 +1000
commitc97389d5f6748c05b88f6461b87b4d21a273ab00 (patch)
tree9458eda88cbdc7e1450c8a130dfacd150747a3c6
parent5c53617aba31abaa7becd9725155b570fac2a90d (diff)
downloadpuppet-c97389d5f6748c05b88f6461b87b4d21a273ab00.tar.gz
puppet-c97389d5f6748c05b88f6461b87b4d21a273ab00.tar.xz
puppet-c97389d5f6748c05b88f6461b87b4d21a273ab00.zip
Made puppetlast work on 0.24.5 by using the YAML indirector
-rwxr-xr-xext/puppetlast12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/puppetlast b/ext/puppetlast
index e8c2ea1a7..848fdde6c 100755
--- a/ext/puppetlast
+++ b/ext/puppetlast
@@ -1,15 +1,14 @@
#!/usr/bin/env ruby
+# Puppetlast, a script to output the last check-in time of nodes. Also outputs the cached configuration state, if expired or not.
#
-# Script to print out when puppet ran successfully last
-# AJ Christensen <aj@junglist.gen.nz>
+# AJ "Fujin" Christensen <aj@junglist.gen.nz>
#
-
require 'puppet'
-require 'puppet/defaults'
-require 'yaml'
Puppet[:config] = "/etc/puppet/puppet.conf"
Puppet.parse_config
+Puppet[:name] = "puppetmasterd"
+Puppet::Node::Facts.terminus_class = :yaml
print "puppetlast\n"
@@ -37,4 +36,7 @@ if yfdir
print 'error: ' + $! + "\n"
end
+Puppet::Node::Facts.search("*").sort.each do |node|
+ puts "#{node.name} #{node.expired? ? 'cached expired, ' : ''}checked in #{((Time.now - node.values[:_timestamp]) / 60).floor} minutes ago"
end
+