diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-11-02 04:14:38 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-11-02 04:14:38 +0000 |
| commit | 42a9d9a3f8ac698370c36c4ca631e82797e01ece (patch) | |
| tree | 7a4eb98ce6d9cf70b2538399aec0a206c9cb79aa /lib/puppet/parser | |
| parent | 300a1632432b5aa5e0221d28fe0a2ce90c422131 (diff) | |
| download | puppet-42a9d9a3f8ac698370c36c4ca631e82797e01ece.tar.gz puppet-42a9d9a3f8ac698370c36c4ca631e82797e01ece.tar.xz puppet-42a9d9a3f8ac698370c36c4ca631e82797e01ece.zip | |
Adding "isomorphic?" method to classes, and testing for isomorphism before throwing a conflict
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@741 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/scope.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 996a497d5..93d97e396 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -542,16 +542,21 @@ module Puppet if obj == :undefined or obj.nil? # Make sure it's not defined elsewhere in the configuration if tmp = self.objectdefined?(name, type) - msg = "Duplicate definition: %s[%s] is already defined" % - [type, name] - error = Puppet::ParseError.new(msg) - if tmp.line - error.line = tmp.line - end - if tmp.file - error.file = tmp.file + typeklass = Puppet::Type.type(type) + if typeklass and ! typeklass.isomorphic? + Puppet.info "Allowing duplicate %s" % type + else + msg = "Duplicate definition: %s[%s] is already defined" % + [type, name] + error = Puppet::ParseError.new(msg) + if tmp.line + error.line = tmp.line + end + if tmp.file + error.file = tmp.file + end + raise error end - raise error end # And if it's not, then create it anew |
