summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-18 22:07:12 -0600
committerLuke Kanies <luke@madstop.com>2008-02-18 22:07:12 -0600
commit0afea69c06742eff1e8d8bd7df13c9c0e4c397c0 (patch)
tree33ed3b2b964dad9ec6129cbc56c12a8f41890cd8 /lib/puppet/node
parenta53106cf08c28e996502cba703f64944250a4b29 (diff)
parent39f9818276e49020c1a6db9667371f7617d5cc93 (diff)
downloadpuppet-0afea69c06742eff1e8d8bd7df13c9c0e4c397c0.tar.gz
puppet-0afea69c06742eff1e8d8bd7df13c9c0e4c397c0.tar.xz
puppet-0afea69c06742eff1e8d8bd7df13c9c0e4c397c0.zip
Merge branch '0.24.x'
Conflicts: CHANGELOG
Diffstat (limited to 'lib/puppet/node')
-rw-r--r--lib/puppet/node/catalog.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb
index b74947107..ee4cedd4b 100644
--- a/lib/puppet/node/catalog.rb
+++ b/lib/puppet/node/catalog.rb
@@ -68,7 +68,11 @@ class Puppet::Node::Catalog < Puppet::PGraph
@resource_table[ref] = resource
+ # If the name and title differ, set up an alias
+ self.alias(resource, resource.name) if resource.respond_to?(:name) and resource.respond_to?(:title) and resource.name != resource.title
+
resource.catalog = self if resource.respond_to?(:catalog=) and ! is_relationship_graph
+
add_vertex(resource)
end
end
@@ -78,7 +82,10 @@ class Puppet::Node::Catalog < Puppet::PGraph
resource.ref =~ /^(.+)\[/
newref = "%s[%s]" % [$1 || resource.class.name, name]
- raise(ArgumentError, "Cannot alias %s to %s; resource %s already exists" % [resource.ref, name, newref]) if @resource_table[newref]
+ 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
@aliases[resource.ref] << newref
end