Skip to content

Commit e96a818

Browse files
committed
catch and rescue from looking up non-existent facts when looking for 'kind'
facter (2.x) only provides facts without interface suffix for * ipaddress * netmask 'macaddress' and 'network' facts will always have the related interface name appended. in turns lookupvar throws errors when strict_variables is enabled.
1 parent f820bb1 commit e96a818

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/puppet/parser/functions/has_interface_with.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ module Puppet::Parser::Functions
3838
# Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
3939
# https://tickets.puppetlabs.com/browse/PUP-3597
4040
factval = nil
41-
catch :undefined_variable do
42-
factval = lookupvar(kind)
41+
begin
42+
catch :undefined_variable do
43+
factval = lookupvar(kind)
44+
end
45+
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
4346
end
4447
if factval == value
4548
return true

0 commit comments

Comments
 (0)