diff options
| author | Luke Kanies <luke@madstop.com> | 2008-01-09 13:03:15 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-01-09 13:03:15 -0800 |
| commit | 5bef4a55b3489a6404ee34b900621af8b784749a (patch) | |
| tree | 82a03e2434597160c8a52125f2c6fd948a942291 /lib/puppet/node | |
| parent | 3cc3e0f5b21deee4fbdbcbae18fba47c7a0cbb1e (diff) | |
| download | puppet-5bef4a55b3489a6404ee34b900621af8b784749a.tar.gz puppet-5bef4a55b3489a6404ee34b900621af8b784749a.tar.xz puppet-5bef4a55b3489a6404ee34b900621af8b784749a.zip | |
Another round of fixes toward making global resources work.
The only remaining failures are more complicated ones (which I'll
need to not be on a plane to debug, for battery reasons) or those
related to the broken directory_service providers.
Diffstat (limited to 'lib/puppet/node')
| -rw-r--r-- | lib/puppet/node/catalog.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb index 0dcfbaefc..4d5100c1d 100644 --- a/lib/puppet/node/catalog.rb +++ b/lib/puppet/node/catalog.rb @@ -64,6 +64,10 @@ class Puppet::Node::Catalog < Puppet::PGraph else @resource_table[ref] = resource end + + if resource.is_a?(Puppet::Type) and resource.class.isomorphic? and resource.title != resource.ref and resource.title != resource[:name] + self.alias(resource, resource[:name]) + end resource.catalog = self unless is_relationship_graph add_vertex!(resource) end @@ -74,7 +78,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 res = @resource_table[newref] + return if res == 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 @@ -321,7 +328,7 @@ class Puppet::Node::Catalog < Puppet::PGraph # Lastly, add in any autorequires @relationship_graph.vertices.each do |vertex| - vertex.autorequire.each do |edge| + vertex.autorequire(@relationship_graph).each do |edge| unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones. unless @relationship_graph.edge?(edge.target, edge.source) vertex.debug "Autorequiring %s" % [edge.source] |
