summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshley Penney <apenney@gmail.com>2013-07-12 06:03:46 -0700
committerAshley Penney <apenney@gmail.com>2013-07-12 06:03:46 -0700
commit8ecb0c94a4633e90f8e892098da10ef08a30b5bc (patch)
tree50fafbcd4f6ad6856785dbf1cc504278936766e2
parent4e815f995d059f462f6c1966ebd6ffbcffa4807e (diff)
parentca913f8a265ea78ca4acae484ff2e817c668d14c (diff)
Merge pull request #69 from simonsd/master
Archlinux now also has an osfamily fact
-rw-r--r--manifests/params.pp22
-rw-r--r--spec/classes/ntp_config_spec.rb44
-rw-r--r--spec/classes/ntp_install_spec.rb22
-rw-r--r--spec/classes/ntp_service_spec.rb6
4 files changed, 35 insertions, 59 deletions
diff --git a/manifests/params.pp b/manifests/params.pp
index f370f8d..3fd8eaf 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -61,20 +61,20 @@ class ntp::params {
'3.freebsd.pool.ntp.org iburst maxpoll 9',
]
}
+ 'Archlinux': {
+ $config = '/etc/ntp.conf'
+ $config_template = 'ntp/ntp.conf.archlinux.erb'
+ $package_name = ['ntp']
+ $service_name = 'ntpd'
+ $servers = [
+ '0.pool.ntp.org',
+ '1.pool.ntp.org',
+ '2.pool.ntp.org',
+ ]
+ }
'Linux': {
# Account for distributions that don't have $::osfamily specific settings.
case $::operatingsystem {
- 'Archlinux': {
- $config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.archlinux.erb'
- $package_name = ['ntp']
- $service_name = 'ntpd'
- $servers = [
- '0.pool.ntp.org',
- '1.pool.ntp.org',
- '2.pool.ntp.org',
- ]
- }
'Gentoo': {
$config = '/etc/ntp.conf'
$config_template = 'ntp/ntp.conf.gentoo.erb'
diff --git a/spec/classes/ntp_config_spec.rb b/spec/classes/ntp_config_spec.rb
index 80bee42..eec939f 100644
--- a/spec/classes/ntp_config_spec.rb
+++ b/spec/classes/ntp_config_spec.rb
@@ -78,6 +78,21 @@ describe 'ntp::config' do
(content.split("\n") & expected_lines).should == expected_lines
end
+ describe "for operating system family Archlinux" do
+
+ let(:params) {{}}
+ let(:facts) {{ :osfamily => 'Archlinux' }}
+
+ it 'should use the NTP pool servers by default' do
+ content = param_value(subject, 'file', '/etc/ntp.conf', 'content')
+ expected_lines = [
+ "server 0.pool.ntp.org",
+ "server 1.pool.ntp.org",
+ "server 2.pool.ntp.org"]
+ (content.split("\n") & expected_lines).should == expected_lines
+ end
+ end
+
describe "for operating system family unsupported" do
let(:facts) {{
:osfamily => 'unsupported',
@@ -93,9 +108,8 @@ describe 'ntp::config' do
describe 'for virtual machines' do
let(:params) {{}}
- let(:facts) {{ :operatingsystem => 'Archlinux',
- :osfamily => 'Linux',
- :is_virtual => true }}
+ let(:facts) {{ :osfamily => 'Archlinux',
+ :is_virtual => true }}
it 'should not use local clock as a time source' do
content = param_value(subject, 'file', '/etc/ntp.conf', 'content')
@@ -116,9 +130,8 @@ describe 'ntp::config' do
describe 'for physical machines' do
let(:params) {{}}
- let(:facts) {{ :operatingsystem => 'Archlinux',
- :osfamily => 'Linux',
- :is_virtual => false }}
+ let(:facts) {{ :osfamily => 'Archlinux',
+ :is_virtual => false }}
it 'disallows large clock skews' do
content = param_value(subject, 'file', '/etc/ntp.conf', 'content')
@@ -128,23 +141,6 @@ describe 'ntp::config' do
end
- describe "for operating system Archlinux" do
-
- let(:params) {{}}
- let(:facts) {{ :operatingsystem => 'Archlinux',
- :osfamily => 'Linux' }}
-
-
- it 'should use the NTP pool servers by default' do
- content = param_value(subject, 'file', '/etc/ntp.conf', 'content')
- expected_lines = [
- "server 0.pool.ntp.org",
- "server 1.pool.ntp.org",
- "server 2.pool.ntp.org"]
- (content.split("\n") & expected_lines).should == expected_lines
- end
- end
-
describe "for operating system Gentoo" do
let(:params) {{}}
@@ -163,7 +159,7 @@ describe 'ntp::config' do
end
end
- ['Debian', 'RedHat','SuSE', 'FreeBSD'].each do |osfamily|
+ ['Debian', 'RedHat','SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily|
describe "for operating system family #{osfamily}" do
let(:facts) {{ :osfamily => osfamily }}
diff --git a/spec/classes/ntp_install_spec.rb b/spec/classes/ntp_install_spec.rb
index 2102878..4ed263e 100644
--- a/spec/classes/ntp_install_spec.rb
+++ b/spec/classes/ntp_install_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'ntp::install' do
- ['Debian', 'RedHat', 'SuSE', 'FreeBSD'].each do |osfamily|
+ ['Debian', 'RedHat', 'SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily|
describe "for osfamily #{osfamily}" do
let(:facts) {{ :osfamily => osfamily }}
@@ -49,24 +49,4 @@ describe 'ntp::install' do
end
- describe "for distribution archlinux" do
-
- let(:facts) {{ :osfamily => 'Linux', :operatingsystem => 'ArchLinux' }}
- let(:params) {{
- :package_ensure => 'present',
- :package_name => 'ntp',
- }}
-
- it { should contain_package('ntp').with(
- :ensure => 'present',
- :name => 'ntp'
- )}
-
- it 'should allow package ensure to be overridden' do
- params[:package_ensure] = 'latest'
- subject.should contain_package('ntp').with_ensure('latest')
- end
-
- end
-
end
diff --git a/spec/classes/ntp_service_spec.rb b/spec/classes/ntp_service_spec.rb
index 7ce1717..bbf9dd1 100644
--- a/spec/classes/ntp_service_spec.rb
+++ b/spec/classes/ntp_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'ntp::service' do
- ['Debian', 'RedHat', 'SuSE', 'FreeBSD'].each do |osfamily|
+ ['Debian', 'RedHat', 'SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily|
describe "for osfamily #{osfamily}" do
let(:facts) {{ :osfamily => osfamily }}
@@ -10,7 +10,7 @@ describe 'ntp::service' do
:service_manage => true,
:service_enable => true,
:service_ensure => 'running',
- :service_name => 'ntp'
+ :service_name => 'ntp'
}}
it { should contain_service('ntp').with(
@@ -26,7 +26,7 @@ describe 'ntp::service' do
end
end
- ['ArchLinux', 'Gentoo'].each do |operatingsystem|
+ ['Gentoo'].each do |operatingsystem|
describe "for distribution #{operatingsystem}" do
let(:facts) {{ :osfamily => 'Linux', :operatingsystem => operatingsystem }}