summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-14 17:46:37 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-14 17:46:37 +0000
commit1d261bfd2d804ca2d2270884e0e84910267bc4ed (patch)
treed8645c2485f09f1105e57eb0455f1402c2da0fe4
parent554c23c42a81ab78afb9f40df73f022fab8b7d68 (diff)
downloadpuppet-1d261bfd2d804ca2d2270884e0e84910267bc4ed.tar.gz
puppet-1d261bfd2d804ca2d2270884e0e84910267bc4ed.tar.xz
puppet-1d261bfd2d804ca2d2270884e0e84910267bc4ed.zip
Fixing error message when a parameter is getting redefined
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2693 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/parser/resource.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index ccb88d69a..18ec15ac0 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -263,7 +263,8 @@ class Puppet::Parser::Resource
paramcheck(param.name)
if current = @params[param.name]
- # XXX Should we ignore any settings that have the same values?
+ # This is where we'd ignore any equivalent values if we wanted to,
+ # but that would introduce a lot of really bad ordering issues.
if param.source.child_of?(current.source)
if param.add
# Merge with previous value.
@@ -278,17 +279,20 @@ class Puppet::Parser::Resource
end
msg = "Parameter '%s' is already set on %s" %
[param.name, self.to_s]
- if param.source.to_s != ""
- msg += " by %s" % param.source
+ if current.source.to_s != ""
+ msg += " by %s" % current.source
end
- if param.file or param.line
+ if current.file or current.line
fields = []
- fields << param.file if param.file
- fields << param.line.to_s if param.line
+ fields << current.file if current.file
+ fields << current.line.to_s if current.line
msg += " at %s" % fields.join(":")
end
msg += "; cannot redefine"
- fail Puppet::ParseError, msg
+ error = Puppet::ParseError.new(msg)
+ error.file = param.file if param.file
+ error.line = param.line if param.line
+ raise error
end
else
if self.source == param.source or param.source.child_of?(self.source)