Merge branch 'philandstuff-master'
* philandstuff-master: Add behavior example for anchor refresh propagation Make the anchor type propagate refresh events closes #78
This commit is contained in:
commit
62bcb8fcf0
2 changed files with 37 additions and 0 deletions
|
@ -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
|
||||
|
|
32
spec/classes/anchor_spec.rb
Normal file
32
spec/classes/anchor_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue