From d3c747b3c22be2592267071075facaaad498a82b Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Thu, 11 Aug 2011 22:18:48 -0500 Subject: (#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. --- lib/puppet/parser/functions/fqdn_rand.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser/functions') 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 -- cgit