summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/templatewrapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/templatewrapper.rb')
-rw-r--r--lib/puppet/parser/templatewrapper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 7a8f74156..4790cea30 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -20,6 +20,15 @@ class Puppet::Parser::TemplateWrapper
end
end
+ # Should return true if a variable is defined, false if it is not
+ def has_variable?(name)
+ if @scope.lookupvar(name.to_s, false) != :undefined
+ true
+ else
+ false
+ end
+ end
+
# Ruby treats variables like methods, so we can cheat here and
# trap missing vars like they were missing methods.
def method_missing(name, *args)