[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. c845591a6888f5d9c9553d862c9f49c5fe349d4d

Micah Anderson micah at riseup.net
Wed Apr 30 11:42:30 UTC 2008


The following commit has been merged in the master branch:
commit 74df8e97fef660311eb2c7e918c0be9554fd3638
Author: James Turnbull <james at lovedthanlost.net>
Date:   Sat Apr 19 21:56:17 2008 +1000

    Added puppetlast script to ext directory

diff --git a/ext/puppetlast b/ext/puppetlast
new file mode 100755
index 0000000..e8c2ea1
--- /dev/null
+++ b/ext/puppetlast
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+#
+# Script to print out when puppet ran successfully last
+# AJ Christensen <aj at junglist.gen.nz>
+#
+
+require 'puppet'
+require 'puppet/defaults'
+require 'yaml'
+
+Puppet[:config] = "/etc/puppet/puppet.conf"
+Puppet.parse_config
+
+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
+
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list