use Smart Parameter Defaults pattern to fix freebsd path

This commit is contained in:
Antoine Beaupré 2013-06-22 13:25:51 -04:00
parent 1f777fc52d
commit 6df937e3ed
3 changed files with 14 additions and 5 deletions

View file

@ -1,6 +1,4 @@
class sudo::freebsd inherits sudo::base {
class { 'sudo': dir => '/usr/local/etc/sudoers.d' }
package{'sudo':
ensure => installed,
}

View file

@ -3,9 +3,9 @@
# GPLv3
class sudo(
$deploy_sudoers = false,
$dir = '/etc/sudoers.d'
) {
$deploy_sudoers = $sudo::deploy_sudoers,
$dir = $sudo::params::dir
) inherits sudo::params {
case $::kernel {
linux: { include sudo::linux }
freebsd: { include sudo::freebsd }

11
manifests/params.pp Normal file
View file

@ -0,0 +1,11 @@
class sudo::params {
$dir = $::kernel ? {
/freebsd/ => '/usr/local/etc/sudoers.d',
default => '/etc/sudoers.d',
}
$path = $::kernel ? {
/freebsd/ => '/usr/local/etc/sudoers',
default => '/etc/sudoers',
}
$deploy_sudoers = false
}