diff options
author | Jeff McCune <jeff@puppetlabs.com> | 2013-04-11 17:57:27 -0700 |
---|---|---|
committer | Jeff McCune <jeff@puppetlabs.com> | 2013-04-11 17:57:27 -0700 |
commit | 62bcb8fcf0d20fc5ddc41eb4cd5d4cfc6cba4c37 (patch) | |
tree | 6cc20a64cd311a271f7a937d12e1a27c03fc81e9 | |
parent | 8bf547991cf2ca65fa41fc3a15b75e88f6ac97fe (diff) | |
parent | d2e692dce3794a57da78bb4624b182d1b379ae6a (diff) |
Merge branch 'philandstuff-master'
* philandstuff-master:
Add behavior example for anchor refresh propagation
Make the anchor type propagate refresh events
closes #78
-rw-r--r-- | lib/puppet/type/anchor.rb | 5 | ||||
-rw-r--r-- | spec/classes/anchor_spec.rb | 32 |
2 files changed, 37 insertions, 0 deletions
diff --git a/lib/puppet/type/anchor.rb b/lib/puppet/type/anchor.rb index 6b81732..fe1e5aa 100644 --- a/lib/puppet/type/anchor.rb +++ b/lib/puppet/type/anchor.rb @@ -38,4 +38,9 @@ Puppet::Type.newtype(:anchor) do desc "The name of the anchor resource." end + def refresh + # We don't do anything with them, but we need this to + # show that we are "refresh aware" and not break the + # chain of propagation. + end end diff --git a/spec/classes/anchor_spec.rb b/spec/classes/anchor_spec.rb new file mode 100644 index 0000000..2dd17de --- /dev/null +++ b/spec/classes/anchor_spec.rb @@ -0,0 +1,32 @@ +require 'puppet' +require 'rspec-puppet' + +describe "anchorrefresh" do + let(:node) { 'testhost.example.com' } + let :pre_condition do + <<-ANCHORCLASS +class anchored { + anchor { 'anchored::begin': } + ~> anchor { 'anchored::end': } +} + +class anchorrefresh { + notify { 'first': } + ~> class { 'anchored': } + ~> anchor { 'final': } +} + ANCHORCLASS + end + + def apply_catalog_and_return_exec_rsrc + catalog = subject.to_ral + transaction = catalog.apply + transaction.resource_status("Anchor[final]") + end + + it 'propagates events through the anchored class' do + resource = apply_catalog_and_return_exec_rsrc + + expect(resource.restarted).to eq(true) + end +end |