diff options
author | Morgan Haskel <morgan@puppetlabs.com> | 2014-11-10 17:15:11 -0800 |
---|---|---|
committer | Morgan Haskel <morgan@puppetlabs.com> | 2014-11-10 17:15:11 -0800 |
commit | 0a8963fbd384a477ee69917b4dd4c0bb405bc153 (patch) | |
tree | 0fbc4c4d58cfb2906a999f92a98ee51150c88dae /lib/puppet/parser/functions | |
parent | d8b86fdcc2711bff15a169552641e6fec0546ccd (diff) | |
parent | 4949cfd21cb97b17006d82f2f192ec9d01b0d1ee (diff) | |
download | puppet-stdlib-0a8963fbd384a477ee69917b4dd4c0bb405bc153.tar.gz puppet-stdlib-0a8963fbd384a477ee69917b4dd4c0bb405bc153.tar.bz2 |
Merge pull request #357 from hunner/hasInterfaceWithLookupBug
(PUP-3597) Catch :undefined_variable when Future Parser is enabled on 3.7.x
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r-- | lib/puppet/parser/functions/has_interface_with.rb | 14 |
1 files changed, 12 insertions, 2 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 |