summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-11-11 18:29:05 +0100
committerJames Turnbull <james@lovedthanlost.net>2009-11-12 08:13:07 +1100
commit40135609c8cfc7b70369a848a383a687a216f6a7 (patch)
tree7a11301fc6e607230ca00021237858d2c3db3848 /spec
parentf05a04eabdee2299f884933010234358c41ac46d (diff)
downloadpuppet-40135609c8cfc7b70369a848a383a687a216f6a7.tar.gz
puppet-40135609c8cfc7b70369a848a383a687a216f6a7.tar.xz
puppet-40135609c8cfc7b70369a848a383a687a216f6a7.zip
Fix #2797 - tags are not inherited by recursed file sub child
This problem affects all types that generate sub-resources at evaluation or pre-transaction time. Thus it is fixed in the transaction, where we make sure we assign all parent tags to the generated child resource. A more correct fix would be to make sure we copy the whole context (ie file, line, version, tags). This fix is planned for Rowlf. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/transaction.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index 7966c7a65..4763b9865 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -51,6 +51,21 @@ describe Puppet::Transaction do
@transaction.generate_additional_resources(generator, :generate).should be_empty
end
+
+ it "should copy all tags to the newly generated resources" do
+ child = stub 'child'
+ generator = stub 'resource', :tags => ["one", "two"]
+
+ @catalog = Puppet::Resource::Catalog.new
+ @transaction = Puppet::Transaction.new(@catalog)
+
+ generator.stubs(:generate).returns [child]
+ @catalog.stubs(:add_resource)
+
+ child.expects(:tag).with("one", "two")
+
+ @transaction.generate_additional_resources(generator, :generate)
+ end
end
describe "when skipping a resource" do