From e96a818782c944b4b1af5417d0bcffc08e95aadc Mon Sep 17 00:00:00 2001 From: Mathias Klette Date: Wed, 24 Jun 2015 14:58:48 +0200 Subject: 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. --- lib/puppet/parser/functions/has_interface_with.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/puppet/parser/functions/has_interface_with.rb') diff --git a/lib/puppet/parser/functions/has_interface_with.rb b/lib/puppet/parser/functions/has_interface_with.rb index 3691524..e762798 100644 --- a/lib/puppet/parser/functions/has_interface_with.rb +++ b/lib/puppet/parser/functions/has_interface_with.rb @@ -38,8 +38,11 @@ has_interface_with("lo") => true # 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) + begin + catch :undefined_variable do + factval = lookupvar(kind) + end + rescue Puppet::ParseError # Eat the exception if strict_variables = true is set end if factval == value return true -- cgit v1.2.3