summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/fqdn_rotate.rb4
-rw-r--r--lib/puppet/parser/functions/validate_integer.rb1
-rw-r--r--lib/puppet/parser/functions/validate_numeric.rb1
3 files changed, 4 insertions, 2 deletions
diff --git a/lib/puppet/parser/functions/fqdn_rotate.rb b/lib/puppet/parser/functions/fqdn_rotate.rb
index cf22d36..d9741a0 100644
--- a/lib/puppet/parser/functions/fqdn_rotate.rb
+++ b/lib/puppet/parser/functions/fqdn_rotate.rb
@@ -39,9 +39,9 @@ Rotates an array a random number of times based on a nodes fqdn.
if defined?(Random) == 'constant' && Random.class == Class
offset = Random.new(seed).rand(elements)
else
- srand(seed)
+ old_seed = srand(seed)
offset = rand(elements)
- srand()
+ srand(old_seed)
end
end
offset.times {
diff --git a/lib/puppet/parser/functions/validate_integer.rb b/lib/puppet/parser/functions/validate_integer.rb
index 995f8db..95da0c4 100644
--- a/lib/puppet/parser/functions/validate_integer.rb
+++ b/lib/puppet/parser/functions/validate_integer.rb
@@ -109,6 +109,7 @@ module Puppet::Parser::Functions
# check every element of the array
input.each_with_index do |arg, pos|
begin
+ raise TypeError if arg.is_a?(Hash)
arg = Integer(arg.to_s)
validator.call(arg)
rescue TypeError, ArgumentError
diff --git a/lib/puppet/parser/functions/validate_numeric.rb b/lib/puppet/parser/functions/validate_numeric.rb
index d2e4d16..3a14443 100644
--- a/lib/puppet/parser/functions/validate_numeric.rb
+++ b/lib/puppet/parser/functions/validate_numeric.rb
@@ -71,6 +71,7 @@ module Puppet::Parser::Functions
# check every element of the array
input.each_with_index do |arg, pos|
begin
+ raise TypeError if arg.is_a?(Hash)
arg = Float(arg.to_s)
validator.call(arg)
rescue TypeError, ArgumentError