summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Hopper <whopper@cat.pdx.edu>2012-05-14 18:14:04 -0700
committerWill Hopper <whopper@cat.pdx.edu>2012-05-14 18:32:14 -0700
commit3f476c3b92852d7934cd770ae3eb6f4e2da6f968 (patch)
tree51549d7a8226fa4d434dd296630529f7a063d40f
parenta78aa83ccded7a4323f97991d1ab0c1ec774cb5b (diff)
(#14492) Update formatting of the NTP module
to reflect Puppet Labs best practices
-rw-r--r--manifests/init.pp84
1 files changed, 41 insertions, 43 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 8843d4b..4a1c596 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -13,10 +13,10 @@
#
# Parameters:
#
-# $servers = [ "0.debian.pool.ntp.org iburst",
-# "1.debian.pool.ntp.org iburst",
-# "2.debian.pool.ntp.org iburst",
-# "3.debian.pool.ntp.org iburst", ]
+# $servers = [ '0.debian.pool.ntp.org iburst',
+# '1.debian.pool.ntp.org iburst',
+# '2.debian.pool.ntp.org iburst',
+# '3.debian.pool.ntp.org iburst', ]
#
# Actions:
#
@@ -32,13 +32,13 @@
# }
#
# [Remember: No empty lines between comments and class definition]
-class ntp($servers="UNSET",
- $ensure="running",
+class ntp($servers='UNSET',
+ $ensure='running',
$autoupdate=false
) {
- if ! ($ensure in [ "running", "stopped" ]) {
- fail("ensure parameter must be running or stopped")
+ if ! ($ensure in [ 'running', 'stopped' ]) {
+ fail('ensure parameter must be running or stopped')
}
if $autoupdate == true {
@@ -46,50 +46,50 @@ class ntp($servers="UNSET",
} elsif $autoupdate == false {
$package_ensure = present
} else {
- fail("autoupdate parameter must be true or false")
+ fail('autoupdate parameter must be true or false')
}
case $::operatingsystem {
debian, ubuntu: {
$supported = true
- $pkg_name = [ "ntp" ]
- $svc_name = "ntp"
- $config = "/etc/ntp.conf"
- $config_tpl = "ntp.conf.debian.erb"
- if ($servers == "UNSET") {
- $servers_real = [ "0.debian.pool.ntp.org iburst",
- "1.debian.pool.ntp.org iburst",
- "2.debian.pool.ntp.org iburst",
- "3.debian.pool.ntp.org iburst", ]
+ $pkg_name = [ 'ntp' ]
+ $svc_name = 'ntp'
+ $config = '/etc/ntp.conf'
+ $config_tpl = 'ntp.conf.debian.erb'
+ if ($servers == 'UNSET') {
+ $servers_real = [ '0.debian.pool.ntp.org iburst',
+ '1.debian.pool.ntp.org iburst',
+ '2.debian.pool.ntp.org iburst',
+ '3.debian.pool.ntp.org iburst', ]
} else {
$servers_real = $servers
}
}
centos, redhat, oel, linux: {
$supported = true
- $pkg_name = [ "ntp" ]
- $svc_name = "ntpd"
- $config = "/etc/ntp.conf"
- $config_tpl = "ntp.conf.el.erb"
- if ($servers == "UNSET") {
- $servers_real = [ "0.centos.pool.ntp.org",
- "1.centos.pool.ntp.org",
- "2.centos.pool.ntp.org", ]
+ $pkg_name = [ 'ntp' ]
+ $svc_name = 'ntpd'
+ $config = '/etc/ntp.conf'
+ $config_tpl = 'ntp.conf.el.erb'
+ if ($servers == 'UNSET') {
+ $servers_real = [ '0.centos.pool.ntp.org',
+ '1.centos.pool.ntp.org',
+ '2.centos.pool.ntp.org', ]
} else {
$servers_real = $servers
}
}
freebsd: {
$supported = true
- $pkg_name = [".*/net/ntp"]
- $svc_name = "ntpd"
- $config = "/etc/ntp.conf"
- $config_tpl = "ntp.conf.freebsd.erb"
- if ($servers == "UNSET") {
- $servers_real = [ "0.freebsd.pool.ntp.org iburst maxpoll 9",
- "1.freebsd.pool.ntp.org iburst maxpoll 9",
- "2.freebsd.pool.ntp.org iburst maxpoll 9",
- "3.freebsd.pool.ntp.org iburst maxpoll 9", ]
+ $pkg_name = ['.*/net/ntp']
+ $svc_name = 'ntpd'
+ $config = '/etc/ntp.conf'
+ $config_tpl = 'ntp.conf.freebsd.erb'
+ if ($servers == 'UNSET') {
+ $servers_real = [ '0.freebsd.pool.ntp.org iburst maxpoll 9',
+ '1.freebsd.pool.ntp.org iburst maxpoll 9',
+ '2.freebsd.pool.ntp.org iburst maxpoll 9',
+ '3.freebsd.pool.ntp.org iburst maxpoll 9', ]
} else {
$servers_real = $servers
}
@@ -104,28 +104,26 @@ class ntp($servers="UNSET",
if ($supported == true) {
- package { "ntp":
+ package { 'ntp':
name => $pkg_name,
ensure => $package_ensure,
}
file { $config:
- ensure => file,
- owner => 0,
- group => 0,
- mode => 0644,
+ ensure => file,
+ owner => 0,
+ group => 0,
+ mode => '0644',
content => template("${module_name}/${config_tpl}"),
require => Package[$pkg_name],
}
- service { "ntp":
+ service { 'ntp':
ensure => $ensure,
name => $svc_name,
hasstatus => true,
hasrestart => true,
subscribe => [ Package[$pkg_name], File[$config] ],
}
-
}
-
}