Skip to content

Commit

Permalink
Merge pull request #272 from jhoblitt/feature/fedora-support
Browse files Browse the repository at this point in the history
fedora support
  • Loading branch information
jonnytdevops committed Jun 24, 2015
2 parents 9067bb6 + 7291d1a commit 8e763ef
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Specifies the stratum the server should operate at when using the undisciplined

##Limitations

This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified. Additionally, it is tested (but not supported) on Solaris 10 and 12.
This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified. Additionally, it is tested (but not supported) on Solaris 10 and 12 and Fedora 20-22.

##Development

Expand Down
72 changes: 50 additions & 22 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

$autoupdate = false
$config_template = 'ntp/ntp.conf.erb'
$disable_monitor = false
$keys_enable = false
$keys_controlkey = ''
$keys_requestkey = ''
Expand Down Expand Up @@ -48,23 +47,24 @@

case $::osfamily {
'AIX': {
$config = $default_config
$keys_file = '/etc/ntp.keys'
$driftfile = '/etc/ntp.drift'
$package_name = [ 'bos.net.tcp.client' ]
$restrict = [
$config = $default_config
$keys_file = '/etc/ntp.keys'
$driftfile = '/etc/ntp.drift'
$package_name = [ 'bos.net.tcp.client' ]
$restrict = [
'default nomodify notrap nopeer noquery',
'127.0.0.1',
]
$service_name = 'xntpd'
$iburst_enable = true
$servers = [
$service_name = 'xntpd'
$iburst_enable = true
$servers = [
'0.debian.pool.ntp.org',
'1.debian.pool.ntp.org',
'2.debian.pool.ntp.org',
'3.debian.pool.ntp.org',
]
$maxpoll = undef
$maxpoll = undef
$disable_monitor = false
}
'Debian': {
$config = $default_config
Expand All @@ -86,26 +86,48 @@
'3.debian.pool.ntp.org',
]
$maxpoll = undef
$disable_monitor = false
}
'RedHat': {
$config = $default_config
$keys_file = $default_keys_file
$driftfile = $default_driftfile
$package_name = $default_package_name
$service_name = $default_service_name
$restrict = [
'default kod nomodify notrap nopeer noquery',
'-6 default kod nomodify notrap nopeer noquery',
'127.0.0.1',
'-6 ::1',
]
$iburst_enable = false
$servers = [
'0.centos.pool.ntp.org',
'1.centos.pool.ntp.org',
'2.centos.pool.ntp.org',
]
$maxpoll = undef

case $::operatingsystem {
'Fedora': {
$restrict = [
'default nomodify notrap nopeer noquery',
'127.0.0.1',
'::1',
]
$iburst_enable = true
$servers = [
'0.fedora.pool.ntp.org',
'1.fedora.pool.ntp.org',
'2.fedora.pool.ntp.org',
'3.fedora.pool.ntp.org',
]
$disable_monitor = true
}
default: {
$restrict = [
'default kod nomodify notrap nopeer noquery',
'-6 default kod nomodify notrap nopeer noquery',
'127.0.0.1',
'-6 ::1',
]
$iburst_enable = false
$servers = [
'0.centos.pool.ntp.org',
'1.centos.pool.ntp.org',
'2.centos.pool.ntp.org',
]
$disable_monitor = false
}
}
}
'Suse': {
if $::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '12'
Expand Down Expand Up @@ -133,6 +155,7 @@
'3.opensuse.pool.ntp.org',
]
$maxpoll = undef
$disable_monitor = false
}
'FreeBSD': {
$config = $default_config
Expand All @@ -154,6 +177,7 @@
'3.freebsd.pool.ntp.org',
]
$maxpoll = 9
$disable_monitor = false
}
'Archlinux': {
$config = $default_config
Expand All @@ -175,6 +199,7 @@
'3.arch.pool.ntp.org',
]
$maxpoll = undef
$disable_monitor = false
}
'Solaris': {
$config = '/etc/inet/ntp.conf'
Expand Down Expand Up @@ -207,6 +232,7 @@
'3.pool.ntp.org',
]
$maxpoll = undef
$disable_monitor = false
}
# Gentoo was added as its own $::osfamily in Facter 1.7.0
'Gentoo': {
Expand All @@ -229,6 +255,7 @@
'3.gentoo.pool.ntp.org',
]
$maxpoll = undef
$disable_monitor = false
}
'Linux': {
# Account for distributions that don't have $::osfamily specific settings.
Expand All @@ -254,6 +281,7 @@
'3.gentoo.pool.ntp.org',
]
$maxpoll = undef
$disable_monitor = false
}
default: {
fail("The ${module_name} module is not supported on an ${::operatingsystem} distribution.")
Expand Down
8 changes: 8 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
"7"
]
},
{
"operatingsystem": "Fedora",
"operatingsystemrelease": [
"20",
"21",
"22"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
Expand Down
9 changes: 9 additions & 0 deletions spec/acceptance/nodesets/fedora-21-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HOSTS:
fedora-21:
roles:
- master
platform: fedora-21-x86_64
box: chef/fedora-21
hypervisor: vagrant
CONFIG:
type: foss
7 changes: 6 additions & 1 deletion spec/acceptance/ntp_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
when 'Debian'
line = '0.debian.pool.ntp.org iburst'
when 'RedHat'
line = '0.centos.pool.ntp.org'
case fact('operatingsystem')
when 'Fedora'
line = '0.fedora.pool.ntp.org'
else
line = '0.centos.pool.ntp.org'
end
when 'Suse'
line = '0.opensuse.pool.ntp.org'
when 'Gentoo'
Expand Down
6 changes: 5 additions & 1 deletion 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', 'Fedora', '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 All @@ -13,6 +13,10 @@
let :facts do
super().merge({ :osfamily => system,:operatingsystem => 'SLES',:operatingsystemmajrelease => '11' })
end
elsif system == 'Fedora'
let :facts do
super().merge({ :osfamily => 'RedHat', :operatingsystem => system ,:operatingsystemmajrelease => '22' })
end
else
let :facts do
super().merge({ :osfamily => system })
Expand Down

0 comments on commit 8e763ef

Please sign in to comment.