Skip to content

Commit 4759120

Browse files
committed
Fix strict_variables = true
1 parent 44c181e commit 4759120

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/puppet/parser/functions/getvar.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ module Puppet::Parser::Functions
1919
raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)")
2020
end
2121

22-
self.lookupvar("#{args[0]}")
22+
begin
23+
self.lookupvar("#{args[0]}")
24+
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
25+
end
2326

2427
end
2528

lib/puppet/parser/functions/has_interface_with.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ module Puppet::Parser::Functions
4141

4242
result = false
4343
interfaces.each do |iface|
44-
if value == lookupvar("#{kind}_#{iface}")
44+
factval = nil
45+
begin
46+
factval = lookupvar("#{kind}_#{iface}")
47+
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
48+
end
49+
if value == factval
4550
result = true
4651
break
4752
end

0 commit comments

Comments
 (0)