# File lib/puppet/resource/catalog.rb, line 97
 97:   def alias(resource, key)
 98:     resource.ref =~ /^(.+)\[/
 99:     class_name = $1 || resource.class.name
100: 
101:     newref = [class_name, key]
102: 
103:     if key.is_a? String
104:       ref_string = "#{class_name}[#{key}]"
105:       return if ref_string == resource.ref
106:     end
107: 
108:     # LAK:NOTE It's important that we directly compare the references,
109:     # because sometimes an alias is created before the resource is
110:     # added to the catalog, so comparing inside the below if block
111:     # isn't sufficient.
112:     if existing = @resource_table[newref]
113:       return if existing == resource
114:       raise(ArgumentError, "Cannot alias #{resource.ref} to #{key.inspect}; resource #{newref.inspect} already exists")
115:     end
116:     @resource_table[newref] = resource
117:     @aliases[resource.ref] ||= []
118:     @aliases[resource.ref] << newref
119:   end