diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-04-26 18:56:19 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-04-26 18:56:19 +0000 |
commit | 3169bfa0eba2d0abf2342a16383243d1ba402fc8 (patch) | |
tree | 186cd034d36625fe41299ea435c6ef778d5d253d /lib/puppet/parser | |
parent | 86c206b1dc51936aadfc1140a97759b5194b629b (diff) | |
download | puppet-3169bfa0eba2d0abf2342a16383243d1ba402fc8.tar.gz puppet-3169bfa0eba2d0abf2342a16383243d1ba402fc8.tar.xz puppet-3169bfa0eba2d0abf2342a16383243d1ba402fc8.zip |
Adding extra info to the "Parameter already set" error, as requested in #573
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2416 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/resource.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 9e14b83ee..906b28aca 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -227,8 +227,18 @@ class Puppet::Parser::Resource if Puppet[:trace] puts caller end - fail Puppet::ParseError, "Parameter %s is already set on %s by %s" % - [param.name, self.to_s, param.source] + msg = "Parameter '%s' is already set on %s" % [param.name, self.to_s] + if param.source.to_s != "" + msg += " by %s" % param.source + end + if param.file or param.line + fields = [] + fields << param.file if param.file + fields << param.line.to_s if param.line + msg += " at %s" % fields.join(":") + end + msg += "; cannot redefine" + fail Puppet::ParseError, msg end else if self.source == param.source or param.source.child_of?(self.source) |