summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/templatewrapper.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2011-06-08 07:03:54 -0700
committerLuke Kanies <luke@puppetlabs.com>2011-07-15 11:51:49 -0700
commit0d2e0672eb516a1b1f2ced6b8c74bd2064dd205e (patch)
tree28d38def94814fcce50b4d82984265dcca7e0545 /lib/puppet/parser/templatewrapper.rb
parent4ad404ee7e7244d94ff4d87effc1a041d65b3f73 (diff)
downloadpuppet-0d2e0672eb516a1b1f2ced6b8c74bd2064dd205e.tar.gz
puppet-0d2e0672eb516a1b1f2ced6b8c74bd2064dd205e.tar.xz
puppet-0d2e0672eb516a1b1f2ced6b8c74bd2064dd205e.zip
Adding []/[]= support to Scope
The interface to scope is much clearer this way anyway, but this is needed to integrate Puppet with Hiera[1]. It just provides hash-like behavior to Scope, which Hiera and others can now easily rely on. I also went through all of the code that used Scope#lookupvar and Scope#setvar and changed it if possible, and at the same time cleaned up a lot of tests that were unnecessarily stubbing (and thus making it difficult to tell if I had actually broken anything). 1 - https://github.com/ripienaar/hiera Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'lib/puppet/parser/templatewrapper.rb')
-rw-r--r--lib/puppet/parser/templatewrapper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 27d75bf92..83d18cc3f 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -25,7 +25,7 @@ class Puppet::Parser::TemplateWrapper
# Should return true if a variable is defined, false if it is not
def has_variable?(name)
- scope.lookupvar(name.to_s, :file => file, :line => script_line) != :undefined
+ scope[name.to_s, {:file => file, :line => script_line}] != :undefined
end
# Allow templates to access the defined classes
@@ -56,7 +56,7 @@ class Puppet::Parser::TemplateWrapper
# the missing_method definition here until we declare the syntax finally
# dead.
def method_missing(name, *args)
- value = scope.lookupvar(name.to_s,:file => file,:line => script_line)
+ value = scope[name.to_s, {:file => file,:line => script_line}]
if value != :undefined
return value
else