summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-01-28 14:26:09 -0600
committerLuke Kanies <luke@madstop.com>2009-02-06 18:08:42 -0600
commit6bb804fb840b3d08f759fb7b7b08633bc3f94a64 (patch)
tree0adfd5cbdaa12c33122802ea87eaadf750df6f4f
parent502e062c27a46e70fdfe833ed32ef1e63b285e31 (diff)
downloadpuppet-6bb804fb840b3d08f759fb7b7b08633bc3f94a64.tar.gz
puppet-6bb804fb840b3d08f759fb7b7b08633bc3f94a64.tar.xz
puppet-6bb804fb840b3d08f759fb7b7b08633bc3f94a64.zip
Removing the Catalog's @aliases hash default value
This was prohibiting the catalog from being dumped. No tests, because I didn't change behaviour and the existing tests provided sufficient coverage. Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r--lib/puppet/resource/catalog.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index e1341012c..d50241d6c 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -106,6 +106,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
raise(ArgumentError, "Cannot alias %s to %s; resource %s already exists" % [resource.ref, name, newref])
end
@resource_table[newref] = resource
+ @aliases[resource.ref] ||= []
@aliases[resource.ref] << newref
end
@@ -286,7 +287,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
@applying = false
@relationship_graph = nil
- @aliases = Hash.new { |hash, key| hash[key] = [] }
+ @aliases = {}
if block_given?
yield(self)
@@ -355,8 +356,10 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
def remove_resource(*resources)
resources.each do |resource|
@resource_table.delete(resource.ref)
- @aliases[resource.ref].each { |res_alias| @resource_table.delete(res_alias) }
- @aliases[resource.ref].clear
+ if aliases = @aliases[resource.ref]
+ aliases.each { |res_alias| @resource_table.delete(res_alias) }
+ @aliases.delete(resource.ref)
+ end
remove_vertex!(resource) if vertex?(resource)
@relationship_graph.remove_vertex!(resource) if @relationship_graph and @relationship_graph.vertex?(resource)
resource.remove