summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-01 00:48:56 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-01 00:48:56 +0000
commitadd6b805e84feb2636335b1b3a87ef1b11db60a5 (patch)
treec83c672ba2aebf8f2f0a24c6e27fc7d36a7df584 /lib/puppet/parser
parent76ff83d86ce2bfaea69bb57af766833ea21095a5 (diff)
downloadpuppet-add6b805e84feb2636335b1b3a87ef1b11db60a5.tar.gz
puppet-add6b805e84feb2636335b1b3a87ef1b11db60a5.tar.xz
puppet-add6b805e84feb2636335b1b3a87ef1b11db60a5.zip
Fixing #160. Fixing the error in Puppet::Type#[]= and scope.newobject
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1230 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/scope.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index e0afbae4a..89cd42022 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -94,17 +94,23 @@ module Puppet::Parser
if typeklass and ! typeklass.isomorphic?
Puppet.info "Allowing duplicate %s" % type
else
+ exobj = @definedtable[type][name]
+
# Either it's a defined type, which are never
# isomorphic, or it's a non-isomorphic type.
msg = "Duplicate definition: %s[%s] is already defined" %
[type, name]
- error = Puppet::ParseError.new(msg)
- if hash[:line]
- error.line = hash[:line]
+
+ if exobj.file and exobj.line
+ msg << " in file %s at line %s" %
+ [exobj.file, exobj.line]
end
- if hash[:file]
- error.file = hash[:file]
+
+ if hash[:line] or hash[:file]
+ msg << "; cannot redefine"
end
+
+ error = Puppet::ParseError.new(msg)
raise error
end
end