Skip to content

Commit 9cd2b1f

Browse files
author
Helen Campbell
committed
Replacing anchor functionality with contain
1 parent 0ed7079 commit 9cd2b1f

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

manifests/init.pp

+8-5
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@
6565
# Anchor this as per #8040 - this ensures that classes won't float off and
6666
# mess everything up. You can read about this at:
6767
# http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues
68-
anchor { 'ntp::begin': } ->
69-
class { '::ntp::install': } ->
70-
class { '::ntp::config': } ~>
71-
class { '::ntp::service': } ->
72-
anchor { 'ntp::end': }
68+
69+
contain ntp::install
70+
contain ntp::config
71+
contain ntp::service
72+
73+
Class['::ntp::install'] ->
74+
Class['::ntp::config'] ~>
75+
Class['::ntp::service']
7376
}

spec/classes/contains_spec.rb

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# To check the correct dependancies are set up for NTP.
2+
3+
require 'spec_helper'
4+
describe 'ntp' do
5+
let(:facts) {{ :is_virtual => 'false' }}
6+
7+
on_supported_os.select { |_, f| f[:os]['family'] != 'Solaris' }.each do |os, f|
8+
context "on #{os}" do
9+
let(:facts) do
10+
f.merge(super())
11+
end
12+
13+
it { is_expected.to compile.with_all_deps }
14+
describe "Testing the dependancies between the classes" do
15+
it { should contain_class('ntp::install') }
16+
it { should contain_class('ntp::config') }
17+
it { should contain_class('ntp::service') }
18+
it { is_expected.to contain_class('ntp::install').that_comes_before('Class[ntp::config]') }
19+
it { is_expected.to contain_class('ntp::service').that_subscribes_to('Class[ntp::config]') }
20+
end
21+
end
22+
end
23+
end

0 commit comments

Comments
 (0)