diff --git a/README.markdown b/README.markdown index 7d96b145..ac0fc2f8 100644 --- a/README.markdown +++ b/README.markdown @@ -210,6 +210,8 @@ The module has been tested on: * Gentoo * Arch Linux * FreeBSD +* Solaris 10 +* AIX 5.3, 6.1, 7.1 Testing on other platforms has been light and cannot be guaranteed. diff --git a/manifests/install.pp b/manifests/install.pp index 098949c3..237f4c1c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,9 +1,8 @@ # class ntp::install inherits ntp { - package { 'ntp': + package { $package_name: ensure => $package_ensure, - name => $package_name, } } diff --git a/manifests/params.pp b/manifests/params.pp index 8bd9127e..960fb5fd 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -131,6 +131,25 @@ '2.pool.ntp.org', ] } + 'Solaris': { + $config = '/etc/inet/ntp.conf' + $driftfile = '/var/ntp/ntp.drift' + $keys_file = '/etc/inet/ntp.keys' + $package_name = [ 'SUNWntpr', 'SUNWntpu' ] + $restrict = [ + 'default kod nomodify notrap nopeer noquery', + '-6 default kod nomodify notrap nopeer noquery', + '127.0.0.1', + '-6 ::1', + ] + $service_name = 'network/ntp' + $servers = [ + '0.pool.ntp.org', + '1.pool.ntp.org', + '2.pool.ntp.org', + '3.pool.ntp.org', + ] + } # Gentoo was added as its own $::osfamily in Facter 1.7.0 'Gentoo': { $config = '/etc/ntp.conf' diff --git a/metadata.json b/metadata.json index 8d4f7392..a5bddf12 100644 --- a/metadata.json +++ b/metadata.json @@ -50,6 +50,12 @@ "14.04" ] }, + { + "operatingsystem": "Solaris", + "operatingsystemrelease": [ + "10" + ] + }, { "operatingsystem": "AIX", "operatingsystemrelease": [ diff --git a/spec/acceptance/ntp_config_spec.rb b/spec/acceptance/ntp_config_spec.rb index 196ba765..c31e5e3d 100644 --- a/spec/acceptance/ntp_config_spec.rb +++ b/spec/acceptance/ntp_config_spec.rb @@ -18,6 +18,8 @@ when 'Gentoo' line = '0.gentoo.pool.ntp.org' end +when 'Solaris' + line = '0.pool.ntp.org' when 'AIX' line = '0.debian.pool.ntp.org iburst' end diff --git a/spec/acceptance/ntp_install_spec.rb b/spec/acceptance/ntp_install_spec.rb index 1a451bbb..aff37558 100644 --- a/spec/acceptance/ntp_install_spec.rb +++ b/spec/acceptance/ntp_install_spec.rb @@ -14,6 +14,8 @@ end when 'AIX' packagename = 'bos.net.tcp.client' +when 'Solaris' + packagename = ['SUNWntpr','SUNWntpu'] else packagename = 'ntp' end @@ -25,7 +27,9 @@ class { 'ntp': } }, :catch_failures => true) end - describe package(packagename) do - it { should be_installed } + Array(packagename).each do |package| + describe package(package) do + it { should be_installed } + end end end diff --git a/spec/acceptance/ntp_parameters_spec.rb b/spec/acceptance/ntp_parameters_spec.rb index 48e6cfdf..95a9c584 100644 --- a/spec/acceptance/ntp_parameters_spec.rb +++ b/spec/acceptance/ntp_parameters_spec.rb @@ -14,6 +14,8 @@ end when 'AIX' packagename = 'bos.net.tcp.client' +when 'Solaris' + packagename = ['SUNWntpr','SUNWntpu'] else packagename = 'ntp' end @@ -109,14 +111,16 @@ class { 'ntp': pp = <<-EOS class { 'ntp': package_ensure => present, - package_name => ['#{packagename}'], + package_name => #{Array(packagename).inspect}, } EOS apply_manifest(pp, :catch_failures => true) end - describe package(packagename) do - it { should be_installed } + Array(packagename).each do |package| + describe package(package) do + it { should be_installed } + end end end diff --git a/spec/acceptance/ntp_service_spec.rb b/spec/acceptance/ntp_service_spec.rb index cac12de5..83c27975 100644 --- a/spec/acceptance/ntp_service_spec.rb +++ b/spec/acceptance/ntp_service_spec.rb @@ -3,6 +3,8 @@ case fact('osfamily') when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo' servicename = 'ntpd' +when 'Solaris' + servicename = 'network/ntp' when 'AIX' servicename = 'xntpd' else diff --git a/spec/classes/ntp_spec.rb b/spec/classes/ntp_spec.rb index 49d6712b..e431975e 100644 --- a/spec/classes/ntp_spec.rb +++ b/spec/classes/ntp_spec.rb @@ -100,8 +100,7 @@ let(:params) {{ :package_ensure => 'present', :package_name => ['ntp'], }} it { should contain_package('ntp').with( - :ensure => 'present', - :name => 'ntp' + :ensure => 'present' )} describe 'should allow package ensure to be overridden' do @@ -111,7 +110,7 @@ describe 'should allow the package name to be overridden' do let(:params) {{ :package_ensure => 'present', :package_name => ['hambaby'] }} - it { should contain_package('ntp').with_name('hambaby') } + it { should contain_package('hambaby') } end end @@ -229,6 +228,16 @@ end end + describe "on osfamily Solaris" do + let(:facts) {{ :osfamily => 'Solaris' }} + + it 'uses the NTP pool servers by default' do + should contain_file('/etc/inet/ntp.conf').with({ + 'content' => /server \d.pool.ntp.org/, + }) + end + end + describe "for operating system family unsupported" do let(:facts) {{ :osfamily => 'unsupported',