Skip to content

Commit

Permalink
Merge pull request #210 from puppetlabs/3.2.x
Browse files Browse the repository at this point in the history
Merge 3.2.x back into master
  • Loading branch information
Morgan Haskel committed Sep 17, 2014
2 parents 6b6e191 + b8069ab commit 3f9726c
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 47 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
##2014-09-10 - Supported Release 3.2.0
###Summary

This is primarily a feature release. It adds a few new parameters to class `ntp`
and adds support for Solaris 11.

####Features
- Add the `$interfaces` parameter to `ntp`
- Add support for Solaris 10 and 11
- Synchronized files with modulesync
- Test updates
- Add the `$iburst_enable` parameter to `ntp`

####Bugfixes
- Fixes for strict variables
- Remove dependency on stdlib4

##2014-06-06 - Release 3.1.2
###Summary

Expand Down
6 changes: 5 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Sets the location of the drift file for ntp.

Set the iburst option in the ntp configuration. If enabled the option is set for every ntp peer.

####`interfaces`

Sets the list of interfaces NTP will listen on. This parameter must be an array.

####`keys_controlkey`

The key to use as the control key.
Expand Down Expand Up @@ -225,7 +229,7 @@ The module has been tested on:
* Gentoo
* Arch Linux
* FreeBSD
* Solaris 10, 11
* Solaris 11
* AIX 5.3, 6.1, 7.1

Testing on other platforms has been light and cannot be guaranteed.
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
'2.centos.pool.ntp.org',
]
}
'SuSE': {
'Suse': {
$config = $default_config
$keys_file = $default_keys_file
$driftfile = '/var/lib/ntp/drift/ntp.drift'
Expand Down
12 changes: 4 additions & 8 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "puppetlabs-ntp",
"version": "3.1.2",
"version": "3.2.0",
"author": "Puppet Labs",
"summary": "NTP Module",
"license": "Apache Version 2.0",
"source": "git://github.com/puppetlabs/puppetlabs-ntp",
"project_page": "http://github.com/puppetlabs/puppetlabs-ntp",
"source": "https://github.com/puppetlabs/puppetlabs-ntp",
"project_page": "https://github.com/puppetlabs/puppetlabs-ntp",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"operatingsystem_support": [
{
Expand Down Expand Up @@ -61,7 +61,6 @@
{
"operatingsystem": "Solaris",
"operatingsystemrelease": [
"10",
"11"
]
},
Expand All @@ -86,9 +85,6 @@
],
"description": "NTP Module for Debian, Ubuntu, CentOS, RHEL, OEL, Fedora, FreeBSD, ArchLinux and Gentoo.",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 3.2.0 < 5.0.0"
}
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0 < 5.0.0"}
]
}
14 changes: 10 additions & 4 deletions spec/acceptance/disable_monitoring_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
require 'spec_helper_acceptance'

if (fact('osfamily') == 'Solaris')
config = '/etc/inet/ntp.conf'
else
config = '/etc/ntp.conf'
end

describe "ntp class with disable_monitor:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
context 'should run successfully' do
pp = "class { 'ntp': disable_monitor => true }"
Expand All @@ -9,8 +15,8 @@
apply_manifest(pp, :catch_changes => true)
end

describe file('/etc/ntp.conf') do
it { should contain('disable monitor') }
describe file("#{config}") do
its(:content) { should match('disable monitor') }
end
end

Expand All @@ -22,8 +28,8 @@
apply_manifest(pp, :catch_changes => true)
end

describe file('/etc/ntp.conf') do
it { should_not contain('disable monitor') }
describe file("#{config}") do
its(:content) { should_not match('disable monitor') }
end
end

Expand Down
12 changes: 9 additions & 3 deletions spec/acceptance/ntp_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
line = '0.debian.pool.ntp.org iburst'
when 'RedHat'
line = '0.centos.pool.ntp.org'
when 'SuSE'
when 'Suse'
line = '0.opensuse.pool.ntp.org'
when 'Gentoo'
line = '0.gentoo.pool.ntp.org'
Expand All @@ -24,15 +24,21 @@
line = '0.debian.pool.ntp.org iburst'
end

if (fact('osfamily') == 'Solaris')
config = '/etc/inet/ntp.conf'
else
config = '/etc/ntp.conf'
end

describe 'ntp::config class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
it 'sets up ntp.conf' do
apply_manifest(%{
class { 'ntp': }
}, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
describe file("#{config}") do
it { should be_file }
it { should contain line }
its(:content) { should match line }
end
end
36 changes: 21 additions & 15 deletions spec/acceptance/ntp_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
packagename = 'ntp'
end

if (fact('osfamily') == 'Solaris')
config = '/etc/inet/ntp.conf'
else
config = '/etc/ntp.conf'
end

describe "ntp class:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
it 'applies successfully' do
pp = "class { 'ntp': }"
Expand Down Expand Up @@ -67,9 +73,9 @@
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
describe file("#{config}") do
it { should be_file }
it { should contain 'testcontent' }
its(:content) { should match 'testcontent' }
end
end

Expand All @@ -79,9 +85,9 @@
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
describe file("#{config}") do
it { should be_file }
it { should contain 'driftfile /tmp/driftfile' }
its(:content) { should match 'driftfile /tmp/driftfile' }
end
end

Expand All @@ -102,12 +108,12 @@ class { 'ntp':
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
describe file("#{config}") do
it { should be_file }
it { should contain 'keys /etc/ntp/keys' }
it { should contain 'controlkey /etc/ntp/controlkey' }
it { should contain 'requestkey 1' }
it { should contain 'trustedkey 1 2' }
its(:content) { should match 'keys /etc/ntp/keys' }
its(:content) { should match 'controlkey /etc/ntp/controlkey' }
its(:content) { should match 'requestkey 1' }
its(:content) { should match 'trustedkey 1 2' }
end
end

Expand Down Expand Up @@ -139,8 +145,8 @@ class { 'ntp':
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
it { should contain 'tinker panic' }
describe file("#{config}") do
its(:content) { should match 'tinker panic' }
end
end

Expand All @@ -154,8 +160,8 @@ class { 'ntp':
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
it { should_not contain 'tinker panic 0' }
describe file("#{config}") do
its(:content) { should_not match 'tinker panic 0' }
end
end

Expand All @@ -165,9 +171,9 @@ class { 'ntp':
apply_manifest(pp, :catch_failures => true)
end

describe file('/etc/ntp.conf') do
describe file("#{config}") do
it { should be_file }
it { should contain '127.127.1.0' }
its(:content) { should match '127.127.1.0' }
end
end

Expand Down
12 changes: 9 additions & 3 deletions spec/acceptance/preferred_servers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
require 'spec_helper_acceptance'

if (fact('osfamily') == 'Solaris')
config = '/etc/inet/ntp.conf'
else
config = '/etc/ntp.conf'
end

describe 'preferred servers', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
pp = <<-EOS
class { '::ntp':
Expand All @@ -14,10 +20,10 @@ class { '::ntp':
end
end

describe file('/etc/ntp.conf') do
describe file("#{config}") do
it { should be_file }
it { should contain 'server a' }
it { should contain 'server b' }
its(:content) { should match 'server a' }
its(:content) { should match 'server b' }
its(:content) { should match /server c (iburst\s|)prefer/ }
its(:content) { should match /server d (iburst\s|)prefer/ }
end
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/restrict_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
require 'spec_helper_acceptance'

if (fact('osfamily') == 'Solaris')
config = '/etc/inet/ntp.conf'
else
config = '/etc/ntp.conf'
end

describe "ntp class with restrict:", :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
context 'should run successfully' do
it 'runs twice' do
Expand All @@ -12,8 +18,8 @@
end
end

describe file('/etc/ntp.conf') do
it { should contain('test restrict') }
describe file("#{config}") do
its(:content) { should match('test restrict') }
end

end
6 changes: 3 additions & 3 deletions spec/classes/ntp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'ntp' do
let(:facts) {{ :is_virtual => 'false' }}

['Debian', 'RedHat','SuSE', 'FreeBSD', 'Archlinux', 'Gentoo', 'Gentoo (Facter < 1.7)'].each do |system|
['Debian', 'RedHat','Suse', 'FreeBSD', 'Archlinux', 'Gentoo', 'Gentoo (Facter < 1.7)'].each do |system|
context "when on system #{system}" do
if system == 'Gentoo (Facter < 1.7)'
let :facts do
Expand Down Expand Up @@ -287,9 +287,9 @@
end
end

describe "on osfamily SuSE" do
describe "on osfamily Suse" do
let :facts do
super().merge({ :osfamily => 'SuSE' })
super().merge({ :osfamily => 'Suse' })
end

it 'uses the opensuse ntp servers by default' do
Expand Down
10 changes: 7 additions & 3 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
on host, "/bin/echo '' > #{host['hieraconf']}"
end
on host, "mkdir -p #{host['distmoduledir']}"
on host, 'puppet module install puppetlabs-stdlib', :acceptable_exit_codes => [0,1]
on host, puppet('module install puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
end
end

Expand All @@ -27,7 +27,11 @@

# Configure all nodes in nodeset
c.before :suite do
# Install module
puppet_module_install(:source => proj_root, :module_name => 'ntp')
hosts.each do |host|
on host, "mkdir -p #{host['distmoduledir']}/ntp"
%w(lib manifests templates metadata.json).each do |file|
scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/ntp"
end
end
end
end
8 changes: 4 additions & 4 deletions templates/ntp.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ disable monitor
# permit the source to query or modify the service on this system.
<% @restrict.flatten.each do |restrict| -%>
restrict <%= restrict %>
<% end %>
<% end -%>
<% end -%>

<% if @interfaces != [] -%>
Expand All @@ -24,7 +24,7 @@ restrict <%= restrict %>
interface ignore wildcard
<% @interfaces.flatten.each do |interface| -%>
interface listen <%= interface %>
<% end %>
<% end -%>
<% end -%>

<% [@servers].flatten.each do |server| -%>
Expand All @@ -42,10 +42,10 @@ restrict 127.127.1.0
# Driftfile.
driftfile <%= @driftfile %>

<% unless @logfile.nil? %>
<% unless @logfile.nil? -%>
# Logfile
logfile = <%= @logfile %>
<% end %>
<% end -%>

<% if @keys_enable -%>
keys <%= @keys_file %>
Expand Down

0 comments on commit 3f9726c

Please sign in to comment.