summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-05-12 21:41:04 -0700
committerLuke Kanies <luke@madstop.com>2008-05-13 11:53:10 -0500
commit49dde1187e8caea10af63ec1f92e19c0e5f1a595 (patch)
treebb5266a65b15749406aaeb219df0cf6bfa3446e6 /lib
parentc1a8d5778f72d31baa913a3e6a6d952024752cf8 (diff)
downloadpuppet-49dde1187e8caea10af63ec1f92e19c0e5f1a595.tar.gz
puppet-49dde1187e8caea10af63ec1f92e19c0e5f1a595.tar.xz
puppet-49dde1187e8caea10af63ec1f92e19c0e5f1a595.zip
Adding has_variable? support, fixing ticket #1177
Diffstat (limited to 'lib')
-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..4f044befc 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -19,6 +19,15 @@ class Puppet::Parser::TemplateWrapper
@scope.parser.watch_file(@file)
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.