summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-15 01:01:08 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-15 01:01:08 +0000
commit3b8c9ff8235e1a2cfc7e17dae9933979e10264b3 (patch)
treefa1a111a1455b5a25902312623f8b3d84c209f88 /lib/puppet
parentbf5d0bc3cd4fd688aae2c0b1b93c32ddcbf3983c (diff)
downloadpuppet-3b8c9ff8235e1a2cfc7e17dae9933979e10264b3.tar.gz
puppet-3b8c9ff8235e1a2cfc7e17dae9933979e10264b3.tar.xz
puppet-3b8c9ff8235e1a2cfc7e17dae9933979e10264b3.zip
Fixing #269. I was aliasing every case where the title and name were different, where I should only have been aliasing isomorphic types, which does not include exec
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1595 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/type.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index ad38cbeec..f422940fe 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -1392,8 +1392,10 @@ class Type < Puppet::Element
begin
obj = new(hash)
rescue => detail
- if Puppet[:debug]
- puts detail.backtrace
+ unless detail.is_a? Puppet::Error
+ if Puppet[:debug]
+ puts detail.backtrace
+ end
end
Puppet.err "Could not create %s: %s" % [title, detail.to_s]
if obj
@@ -1596,8 +1598,16 @@ class Type < Puppet::Element
self.devfail "I was not passed a namevar"
end
+ # If the name and title differ, set up an alias
if self.name != self.title
- self.class.alias(self.name, self)
+ if obj = self.class[self.name]
+ if self.class.isomorphic?
+ raise Puppet::Error, "%s already exists with name %s" %
+ [obj.title, self.name]
+ end
+ else
+ self.class.alias(self.name, self)
+ end
end
# The information to cache to disk. We have to do this after