[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. 90c4a6028cf6ebd530af736ce08f1b413698b162
Micah Anderson
micah at riseup.net
Sat May 31 17:15:34 UTC 2008
The following commit has been merged in the master branch:
commit b95fe151ff222216e6f16b505d72d3d35253c497
Author: James Turnbull <james at lovedthanlost.net>
Date: Thu May 22 17:10:30 2008 +1000
Added cron random function fixing ticket #311
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index c46a7c8..9f1e7c4 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -390,6 +390,21 @@ Puppet::Type.newtype(:cron) do
}
end
+ newfunction(:fqdn_rand, :type => :rvalue, :doc => "Generates random numbers
+ based on the node's fqdn. The first argument sets the range. The second
+ argument specifies a number to add to the seed and is optional.") do |args|
+ require 'md5'
+ max = args[0]
+ if args[1] then
+ seed = args[1]
+ else
+ seed = 1
+ end
+ fqdn_seed = MD5.new(lookupvar('fqdn')).to_s.hex
+ srand(seed+fqdn_seed)
+ rand(max).to_s
+ end
+
# We have to reorder things so that :provide is before :target
attr_accessor :uid
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list