summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/scope.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-28 00:07:41 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-28 00:07:41 +0000
commit07fce232e6a0bb0cfd2e1c84b933e41f851a2045 (patch)
tree97cf30110177625a52ee32630d936222763f4aef /lib/puppet/parser/scope.rb
parentd5444e0dd8fc8c419ebd5239512b81438bbec847 (diff)
downloadpuppet-07fce232e6a0bb0cfd2e1c84b933e41f851a2045.tar.gz
puppet-07fce232e6a0bb0cfd2e1c84b933e41f851a2045.tar.xz
puppet-07fce232e6a0bb0cfd2e1c84b933e41f851a2045.zip
Fixing #477. setvar() can now accept the file and line info from callers.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2237 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/scope.rb')
-rw-r--r--lib/puppet/parser/scope.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 6b6e31373..bf4f7215e 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -519,12 +519,19 @@ class Puppet::Parser::Scope
# Set a variable in the current scope. This will override settings
# in scopes above, but will not allow variables in the current scope
# to be reassigned if we're declarative (which is the default).
- def setvar(name,value)
+ def setvar(name,value, file = nil, line = nil)
#Puppet.debug "Setting %s to '%s' at level %s" %
# [name.inspect,value,self.level]
if @symtable.include?(name)
if @@declarative
- raise Puppet::ParseError, "Cannot reassign variable %s" % name
+ error = Puppet::ParseError.new("Cannot reassign variable %s" % name)
+ if file
+ error.file = file
+ end
+ if line
+ error.line = line
+ end
+ raise error
else
Puppet.warning "Reassigning %s to %s" % [name,value]
end