summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-06-16 23:41:33 -0500
committerLuke Kanies <luke@madstop.com>2008-06-16 23:46:06 -0500
commit4d9536418d8f684923063eac03d3a59d69bb3794 (patch)
tree1225c14b60e61989eafee80614f40db1af12b868 /lib
parent543181272da492755e9219530d17f76a63faffef (diff)
downloadpuppet-4d9536418d8f684923063eac03d3a59d69bb3794.tar.gz
puppet-4d9536418d8f684923063eac03d3a59d69bb3794.tar.xz
puppet-4d9536418d8f684923063eac03d3a59d69bb3794.zip
Fixed #1221 - aliases to titles now work for resources.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/node/catalog.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb
index 7d9a83795..720b3752d 100644
--- a/lib/puppet/node/catalog.rb
+++ b/lib/puppet/node/catalog.rb
@@ -88,8 +88,13 @@ class Puppet::Node::Catalog < Puppet::PGraph
resource.ref =~ /^(.+)\[/
newref = "%s[%s]" % [$1 || resource.class.name, name]
+
+ # LAK:NOTE It's important that we directly compare the references,
+ # because sometimes an alias is created before the resource is
+ # added to the catalog, so comparing inside the below if block
+ # isn't sufficient.
+ return if newref == resource.ref
if existing = @resource_table[newref]
- return if existing == resource
raise(ArgumentError, "Cannot alias %s to %s; resource %s already exists" % [resource.ref, name, newref])
end
@resource_table[newref] = resource