Skip to content

Commit 67e01b2

Browse files
author
Ashley Penney
committed
Merge pull request #172 from hunner/feature-solaris
(MODULES-213) Solaris 10 support
2 parents 324868e + 66e0c92 commit 67e01b2

9 files changed

+57
-10
lines changed

README.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ The module has been tested on:
221221
* Gentoo
222222
* Arch Linux
223223
* FreeBSD
224+
* Solaris 10
225+
* AIX 5.3, 6.1, 7.1
224226

225227
Testing on other platforms has been light and cannot be guaranteed.
226228

manifests/install.pp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#
22
class ntp::install inherits ntp {
33

4-
package { 'ntp':
4+
package { $package_name:
55
ensure => $package_ensure,
6-
name => $package_name,
76
}
87

98
}

manifests/params.pp

+19
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,25 @@
132132
'2.pool.ntp.org',
133133
]
134134
}
135+
'Solaris': {
136+
$config = '/etc/inet/ntp.conf'
137+
$driftfile = '/var/ntp/ntp.drift'
138+
$keys_file = '/etc/inet/ntp.keys'
139+
$package_name = [ 'SUNWntpr', 'SUNWntpu' ]
140+
$restrict = [
141+
'default kod nomodify notrap nopeer noquery',
142+
'-6 default kod nomodify notrap nopeer noquery',
143+
'127.0.0.1',
144+
'-6 ::1',
145+
]
146+
$service_name = 'network/ntp'
147+
$servers = [
148+
'0.pool.ntp.org',
149+
'1.pool.ntp.org',
150+
'2.pool.ntp.org',
151+
'3.pool.ntp.org',
152+
]
153+
}
135154
# Gentoo was added as its own $::osfamily in Facter 1.7.0
136155
'Gentoo': {
137156
$config = '/etc/ntp.conf'

metadata.json

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
"14.04"
5151
]
5252
},
53+
{
54+
"operatingsystem": "Solaris",
55+
"operatingsystemrelease": [
56+
"10"
57+
]
58+
},
5359
{
5460
"operatingsystem": "AIX",
5561
"operatingsystemrelease": [

spec/acceptance/ntp_config_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
when 'Gentoo'
1919
line = '0.gentoo.pool.ntp.org'
2020
end
21+
when 'Solaris'
22+
line = '0.pool.ntp.org'
2123
when 'AIX'
2224
line = '0.debian.pool.ntp.org iburst'
2325
end

spec/acceptance/ntp_install_spec.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
end
1515
when 'AIX'
1616
packagename = 'bos.net.tcp.client'
17+
when 'Solaris'
18+
packagename = ['SUNWntpr','SUNWntpu']
1719
else
1820
packagename = 'ntp'
1921
end
@@ -25,7 +27,9 @@ class { 'ntp': }
2527
}, :catch_failures => true)
2628
end
2729

28-
describe package(packagename) do
29-
it { should be_installed }
30+
Array(packagename).each do |package|
31+
describe package(package) do
32+
it { should be_installed }
33+
end
3034
end
3135
end

spec/acceptance/ntp_parameters_spec.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
end
1515
when 'AIX'
1616
packagename = 'bos.net.tcp.client'
17+
when 'Solaris'
18+
packagename = ['SUNWntpr','SUNWntpu']
1719
else
1820
packagename = 'ntp'
1921
end
@@ -109,14 +111,16 @@ class { 'ntp':
109111
pp = <<-EOS
110112
class { 'ntp':
111113
package_ensure => present,
112-
package_name => ['#{packagename}'],
114+
package_name => #{Array(packagename).inspect},
113115
}
114116
EOS
115117
apply_manifest(pp, :catch_failures => true)
116118
end
117119

118-
describe package(packagename) do
119-
it { should be_installed }
120+
Array(packagename).each do |package|
121+
describe package(package) do
122+
it { should be_installed }
123+
end
120124
end
121125
end
122126

spec/acceptance/ntp_service_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
case fact('osfamily')
44
when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo'
55
servicename = 'ntpd'
6+
when 'Solaris'
7+
servicename = 'network/ntp'
68
when 'AIX'
79
servicename = 'xntpd'
810
else

spec/classes/ntp_spec.rb

+12-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@
121121
let(:params) {{ :package_ensure => 'present', :package_name => ['ntp'], }}
122122

123123
it { should contain_package('ntp').with(
124-
:ensure => 'present',
125-
:name => 'ntp'
124+
:ensure => 'present'
126125
)}
127126

128127
describe 'should allow package ensure to be overridden' do
@@ -132,7 +131,7 @@
132131

133132
describe 'should allow the package name to be overridden' do
134133
let(:params) {{ :package_ensure => 'present', :package_name => ['hambaby'] }}
135-
it { should contain_package('ntp').with_name('hambaby') }
134+
it { should contain_package('hambaby') }
136135
end
137136
end
138137

@@ -250,6 +249,16 @@
250249
end
251250
end
252251

252+
describe "on osfamily Solaris" do
253+
let(:facts) {{ :osfamily => 'Solaris' }}
254+
255+
it 'uses the NTP pool servers by default' do
256+
should contain_file('/etc/inet/ntp.conf').with({
257+
'content' => /server \d.pool.ntp.org/,
258+
})
259+
end
260+
end
261+
253262
describe "for operating system family unsupported" do
254263
let(:facts) {{
255264
:osfamily => 'unsupported',

0 commit comments

Comments
 (0)