summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/node/catalog.rb10
-rwxr-xr-xspec/unit/node/catalog.rb2
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb
index f885a41ee..ecda472be 100644
--- a/lib/puppet/node/catalog.rb
+++ b/lib/puppet/node/catalog.rb
@@ -84,6 +84,7 @@ class Puppet::Node::Catalog < Puppet::PGraph
# Create an alias for a resource.
def alias(resource, name)
+ #set $1
resource.ref =~ /^(.+)\[/
newref = "%s[%s]" % [$1 || resource.class.name, name]
@@ -475,6 +476,15 @@ class Puppet::Node::Catalog < Puppet::PGraph
vertices.each do |resource|
next if resource.respond_to?(:virtual?) and resource.virtual?
+ #This is hackity hack for 1094
+ #Aliases aren't working in the ral catalog because the current instance of the resource
+ #has a reference to the catalog being converted. . . So, give it a reference to the new one
+ #problem solved. . .
+ if resource.is_a?(Puppet::TransObject)
+ resource = resource.dup
+ resource.catalog = result
+ end
+
newres = resource.send(convert)
# We can't guarantee that resources don't munge their names
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index 604dabbb6..360dd87f2 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -304,6 +304,8 @@ describe Puppet::Node::Catalog, " when converting to a RAL catalog" do
resource = stub 'resource', :name => "changer2", :title => "changer2", :ref => "Test[changer2]", :catalog= => nil, :remove => nil
+ #changer is going to get duplicated as part of a fix for aliases 1094
+ changer.expects(:dup).returns(changer)
changer.expects(:to_type).returns(resource)
newconfig = nil