X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fgetvar.rb;h=3af8d48103b3a5e25baba2127a11c08e86a19bd6;hb=6963202b4b62c2816655ac9532521b018fdf83bd;hp=fb336b6aca070932b015d96fbb97abdea61a6607;hpb=a69999e580f8b3abd12446c2d6ad59e517651813;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/getvar.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/getvar.rb index fb336b6ac..3af8d4810 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/getvar.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/getvar.rb @@ -20,7 +20,13 @@ module Puppet::Parser::Functions end begin - self.lookupvar("#{args[0]}") + result = nil + catch(:undefined_variable) do + result = self.lookupvar("#{args[0]}") + end + + # avoid relying on incosistent behaviour around ruby return values from catch + result rescue Puppet::ParseError # Eat the exception if strict_variables = true is set end