remove duplicate code between linux and freebsd

now everything is managed through parameters

we still don't install the package on platforms other than freebsd and
linux to respect the current policy, so this actually is just a refactoring
This commit is contained in:
Antoine Beaupré 2013-06-22 13:36:33 -04:00
parent 92073a7370
commit 6b8fb05ac9
4 changed files with 23 additions and 37 deletions

View file

@ -1,18 +0,0 @@
class sudo::base {
if $sudo::deploy_sudoers {
file {
$sudo::path:
source => [ "puppet:///modules/site_sudo/sudoers/${::fqdn}/sudoers",
"puppet:///modules/site_sudo/sudoers/sudoers",
"puppet:///modules/sudo/sudoers/${::operatingsystem}/sudoers",
"puppet:///modules/sudo/sudoers/sudoers" ],
owner => root, group => 0, mode => 0440;
}
}
file {
$sudo::dir:
ensure => directory,
owner => root, group => 0, mode => 0550;
}
}

View file

@ -1,5 +0,0 @@
class sudo::freebsd inherits sudo::base {
package{'sudo':
ensure => installed,
}
}

View file

@ -8,8 +8,28 @@ class sudo(
$dir = $sudo::params::dir
) inherits sudo::params {
case $::kernel {
linux: { include sudo::linux }
freebsd: { include sudo::freebsd }
default: { include sudo::base }
# XXX: why don't we install the package everywhere?
linux,freebsd: {
package {'sudo':
ensure => installed,
}
}
}
if $sudo::deploy_sudoers {
file {
$sudo::path:
source => [ "puppet:///modules/site_sudo/sudoers/${::fqdn}/sudoers",
"puppet:///modules/site_sudo/sudoers/sudoers",
"puppet:///modules/sudo/sudoers/${::operatingsystem}/sudoers",
"puppet:///modules/sudo/sudoers/sudoers" ],
require => Package['sudo'],
owner => root, group => 0, mode => 0440;
}
}
file {
$sudo::dir:
ensure => directory,
require => Package['sudo'],
owner => root, group => 0, mode => 0550;
}
}

View file

@ -1,11 +0,0 @@
class sudo::linux inherits sudo::base {
package{'sudo':
ensure => installed,
}
if $sudo_deploy_sudoers {
File['/etc/sudoers']{
require => Package['sudo'],
}
}
}