[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
AJ Christensen
aj at junglist.gen.nz
Fri Jan 23 14:20:43 UTC 2009
The following commit has been merged in the master branch:
commit 971af69b7388cf5155bb124246f2a697578cc6e9
Author: AJ Christensen <aj at junglist.gen.nz>
Date: Sat Jul 26 16:50:48 2008 +1200
Fixing puppetlast to make it work with 0.24.5 / 0.25.
Tidied up some of the code a little
diff --git a/ext/puppetlast b/ext/puppetlast
index e8c2ea1..c77d1ba 100755
--- a/ext/puppetlast
+++ b/ext/puppetlast
@@ -15,26 +15,21 @@ print "puppetlast\n"
nodes = {}
-yfdir = Puppet.settings.value(:vardir) + "/yaml/facts"
-
-if yfdir
- begin
- Dir.chdir(yfdir) do
- Dir.glob("*.yaml").each do |yaml|
- data = YAML.load_file(yaml)
- t = Time.now
- age = t - data.version
- nodes[data.name] = age.to_i
- end
- end
-
- nodes.sort.each do |node,age|
- minutes = age / 60 + 0.5
- print minutes.floor.to_s + ' minutes ago: ' + node + "\n"
- end
-
- rescue
- print 'error: ' + $! + "\n"
- end
-
+factsdir = Puppet.settings.value(:vardir) + "/yaml/facts"
+
+begin
+ Dir.chdir(factsdir) if File.exists?(factsdir)
+ Dir.glob("*.yaml").each do |yaml|
+ data = YAML.load_file(yaml)
+ age = Time.now - data.values[:_timestamp]
+ nodes[data.name] = age.to_i
+ end
+
+ nodes.sort.each do |node,age|
+ minutes = age / 60
+ puts minutes.floor.to_s + ' minutes ago: ' + node
+ end
+
+rescue
+ puts 'error: ' + $!
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list