Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## root@junglist:~# ./test.rb ## puppetlast ## 2099.5 minutes ago: junglist.gen.nz ## 86692.5 minutes ago: junglist.junglist.gen.nz ## root@junglist:~# cat test.rb #!/usr/bin/env ruby # # Script to print out when puppet ran successfully last # AJ Christensen <aj@junglist.gen.nz> # require 'puppet' require 'yaml' Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config pm_conf = Puppet.settings.instance_variable_get(:@values)[:main] print "puppetlast\n" nodes = {} Dir.chdir(pm_conf[:vardir] + "/yaml/facts") 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 nodes.sort.each do |node,age| minutes = age / 60 + 0.5 print minutes.to_s + ' minutes ago: ' + node + "\n" end
This paste will be private.
From the Design Piracy series on my blog: