-
Notifications
You must be signed in to change notification settings - Fork 20
Add support for ignore_local_clock #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/ntp\/keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -81,7 +81,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/ntp\/keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -126,7 +126,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/ntp\/keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -213,7 +213,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/inet\/ntp.keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -277,7 +277,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/inet\/ntp.keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -335,7 +335,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/inet\/ntp.keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -395,7 +395,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/inet\/ntp.keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
|
||
it { should_not contain_file('admin_file') } | ||
|
||
|
@@ -445,7 +445,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should contain_file('ntp_conf').with_content(/^keys \/etc\/inet\/ntp.keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
|
||
it { | ||
should contain_file('admin_file').with({ | ||
|
@@ -501,7 +501,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should_not contain_file('ntp_conf').with_content(/^keys \/etc\/ntp\/keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -555,7 +555,7 @@ | |
it { should contain_file('ntp_conf').with_content(/# Statistics are not being logged/) } | ||
it { should contain_file('ntp_conf').with_content(/server 0.us.pool.ntp.org\nserver 1.us.pool.ntp.org\nserver 2.us.pool.ntp.org/) } | ||
it { should_not contain_file('ntp_conf').with_content(/^keys \/etc\/ntp\/keys$/) } | ||
it { should contain_file('ntp_conf').with_content(/fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -4 default kod notrap nomodify nopeer noquery$/) } | ||
it { should contain_file('ntp_conf').with_content(/^restrict -6 default kod notrap nomodify nopeer noquery$/) } | ||
|
||
|
@@ -747,5 +747,20 @@ | |
end | ||
end | ||
|
||
describe 'with ignore_local_clock set' do | ||
let(:facts) { { :osfamily => 'RedHat' } } | ||
|
||
context 'to true' do | ||
let(:params) { { :ignore_local_clock => true } } | ||
|
||
it { should contain_file('ntp_conf').with_content(/^#fudge 127.127.1.0 stratum 10/) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of commenting it out, the line should be removed. The test would then be
|
||
end | ||
|
||
context 'to false' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here with |
||
let(:params) { { :ignore_local_clock => false } } | ||
|
||
it { should contain_file('ntp_conf').with_content(/^fudge 127.127.1.0 stratum 10/) } | ||
end | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,13 @@ restrict ::1 | |
|
||
# Undisciplined Local Clock. This is a fake driver intended for backup | ||
# and when no outside source of synchronized time is available. | ||
<% if @my_ignore_local_clock == true -%> | ||
#server 127.127.1.0 # local clock | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the commented out lines and the else statement. This seems to be the reverse of your logic since the default you specify is false, so these lines would not be there. I think your logic should likely be |
||
#fudge 127.127.1.0 stratum <%= @fudge_stratum %> | ||
<% else %> | ||
server 127.127.1.0 # local clock | ||
fudge 127.127.1.0 stratum <%= @fudge_stratum %> | ||
<% end -%> | ||
|
||
<% if @keys_real -%> | ||
# Key file containing the keys and key identifiers used when operating | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be an array of
['true',true]
to test both the boolean and the stringified boolean.Here's an example
https://github.com/ghoneycutt/puppet-module-ssh/blob/master/spec/classes/init_spec.rb#L1646-1675