diff options
author | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-04-23 01:42:21 +0100 |
---|---|---|
committer | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-04-23 01:44:24 +0100 |
commit | 54b0d37bacb8b95f1b22aa97bd958ed798da9342 (patch) | |
tree | 2e25b8642724b28b11a0dc442fb34446120be118 | |
parent | 399dd8cca8d527e40558cbb44eab1c1b5111d6c3 (diff) |
We do not need cronrand.rb any more.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
-rw-r--r-- | cronrand.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/cronrand.rb b/cronrand.rb deleted file mode 100644 index 3dd6810..0000000 --- a/cronrand.rb +++ /dev/null @@ -1,31 +0,0 @@ -# vim: set ts=2 sw=2 et : -# TODO: path should not be hardcoded here -# -# USAGE: -# $minutes = cronrand("puppet-run", $fqdn, 59) -# file { "puppet-cron": -# name => /etc/cron.d/puppet-run", -# content => "$minutes * * * * root /usr/sbin/puppetd --onetime --no-daemonize --logdest syslog > /dev/null 2>&1\n" -# } -# --- -# minutes will be chosen random and saved for each $fqdn, -# second puppet run on same host will create same content as first one. - -module Puppet::Parser::Functions - newfunction(:cronrand, :type => :rvalue) do |args| - job = args[0] - host = args[1] - minutes = (args[2].to_i < 60) ? args[2].to_i : 59 - filename = "/etc/puppet/modules/puppet/state/cronminutes-#{job}-#{host}" - value = 0 - - if FileTest.exists?(filename) - File.open(filename, 'r') { |fd| value = fd.gets.chomp.to_i } - else - value = rand(minutes) - File.open(filename, 'w') { |fd| fd.puts value } - end - value - end -end - |