summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorNan Liu <nan@puppetlabs.com>2011-08-11 22:18:48 -0500
committerNan Liu <nan@puppetlabs.com>2011-08-11 22:18:48 -0500
commitd3c747b3c22be2592267071075facaaad498a82b (patch)
tree4767765495986536d5e1b65b92ed4c1aedf934a7 /lib/puppet/parser/functions
parentc833fde370d43023f52c8f2e11fd77e720d0f577 (diff)
downloadpuppet-d3c747b3c22be2592267071075facaaad498a82b.tar.gz
puppet-d3c747b3c22be2592267071075facaaad498a82b.tar.xz
puppet-d3c747b3c22be2592267071075facaaad498a82b.zip
(#8814) Update fqdn_rand for ruby 1.9.2 rand bug.
Ruby 1.9.2 does not accept a string for rand function, so rand('1') fails even though this works in Ruby 1.8.x and the string is implicitly converted to a number. We added to_i to avoid this bug.
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/fqdn_rand.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/fqdn_rand.rb b/lib/puppet/parser/functions/fqdn_rand.rb
index 668802e73..3b1df6d95 100644
--- a/lib/puppet/parser/functions/fqdn_rand.rb
+++ b/lib/puppet/parser/functions/fqdn_rand.rb
@@ -6,7 +6,7 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
$random_number = fqdn_rand(30)
$random_number_seed = fqdn_rand(30,30)") do |args|
require 'digest/md5'
- max = args.shift
+ max = args.shift.to_i
srand(Digest::MD5.hexdigest([self['::fqdn'],args].join(':')).hex)
rand(max).to_s
end