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.
This commit is contained in:
parent
f820bb1560
commit
e96a818782
1 changed files with 5 additions and 2 deletions
|
@ -38,8 +38,11 @@ has_interface_with("lo") => true
|
||||||
# Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
|
# Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
|
||||||
# https://tickets.puppetlabs.com/browse/PUP-3597
|
# https://tickets.puppetlabs.com/browse/PUP-3597
|
||||||
factval = nil
|
factval = nil
|
||||||
catch :undefined_variable do
|
begin
|
||||||
factval = lookupvar(kind)
|
catch :undefined_variable do
|
||||||
|
factval = lookupvar(kind)
|
||||||
|
end
|
||||||
|
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
|
||||||
end
|
end
|
||||||
if factval == value
|
if factval == value
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue