summaryrefslogtreecommitdiff
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions/has_interface_with.rb14
-rw-r--r--lib/puppet/parser/functions/range.rb26
2 files changed, 25 insertions, 15 deletions
diff --git a/lib/puppet/parser/functions/has_interface_with.rb b/lib/puppet/parser/functions/has_interface_with.rb
index 00e405d..3691524 100644
--- a/lib/puppet/parser/functions/has_interface_with.rb
+++ b/lib/puppet/parser/functions/has_interface_with.rb
@@ -35,7 +35,13 @@ has_interface_with("lo") => true
kind, value = args
- if lookupvar(kind) == value
+ # Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
+ # https://tickets.puppetlabs.com/browse/PUP-3597
+ factval = nil
+ catch :undefined_variable do
+ factval = lookupvar(kind)
+ end
+ if factval == value
return true
end
@@ -44,7 +50,11 @@ has_interface_with("lo") => true
iface.downcase!
factval = nil
begin
- factval = lookupvar("#{kind}_#{iface}")
+ # Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
+ # https://tickets.puppetlabs.com/browse/PUP-3597
+ catch :undefined_variable do
+ factval = lookupvar("#{kind}_#{iface}")
+ end
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
end
if value == factval
diff --git a/lib/puppet/parser/functions/range.rb b/lib/puppet/parser/functions/range.rb
index ffbdf84..49fba21 100644
--- a/lib/puppet/parser/functions/range.rb
+++ b/lib/puppet/parser/functions/range.rb
@@ -65,21 +65,21 @@ Will return: [0,2,4,6,8]
end
end
- # Check whether we have integer value if so then make it so ...
- if start.match(/^\d+$/)
- start = start.to_i
- stop = stop.to_i
- else
- start = start.to_s
- stop = stop.to_s
- end
+ # Check whether we have integer value if so then make it so ...
+ if start.to_s.match(/^\d+$/)
+ start = start.to_i
+ stop = stop.to_i
+ else
+ start = start.to_s
+ stop = stop.to_s
+ end
- range = case type
- when /^(\.\.|\-)$/ then (start .. stop)
- when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ...
- end
+ range = case type
+ when /^(\.\.|\-)$/ then (start .. stop)
+ when /^(\.\.\.)$/ then (start ... stop) # Exclusive of last element ...
+ end
- result = range.step(step).collect { |i| i } # Get them all ... Pokemon ...
+ result = range.step(step).collect { |i| i } # Get them all ... Pokemon ...
return result
end