]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
catch and rescue from looking up non-existent facts when looking for 'kind'
authorMathias Klette <mathias.klette@magicinternet.de>
Wed, 24 Jun 2015 12:58:48 +0000 (14:58 +0200)
committerMathias Klette <mathias.klette@magicinternet.de>
Wed, 24 Jun 2015 13:02:02 +0000 (15:02 +0200)
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

index 36915246d26fe6f3fada1596d6fdbb8c4e20e2b8..e7627982d9208d6a25b65dc335e8f27c74faaaf1 100644 (file)
@@ -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