From 6b8fb05ac983dd062d8d1295a95f221dfc919e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 22 Jun 2013 13:36:33 -0400 Subject: [PATCH] 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 --- manifests/base.pp | 18 ------------------ manifests/freebsd.pp | 5 ----- manifests/init.pp | 26 +++++++++++++++++++++++--- manifests/linux.pp | 11 ----------- 4 files changed, 23 insertions(+), 37 deletions(-) delete mode 100644 manifests/base.pp delete mode 100644 manifests/freebsd.pp delete mode 100644 manifests/linux.pp diff --git a/manifests/base.pp b/manifests/base.pp deleted file mode 100644 index dfe3f94..0000000 --- a/manifests/base.pp +++ /dev/null @@ -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; - } - -} diff --git a/manifests/freebsd.pp b/manifests/freebsd.pp deleted file mode 100644 index a419da1..0000000 --- a/manifests/freebsd.pp +++ /dev/null @@ -1,5 +0,0 @@ -class sudo::freebsd inherits sudo::base { - package{'sudo': - ensure => installed, - } -} diff --git a/manifests/init.pp b/manifests/init.pp index 09f9493..f962834 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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; } } diff --git a/manifests/linux.pp b/manifests/linux.pp deleted file mode 100644 index 65517a8..0000000 --- a/manifests/linux.pp +++ /dev/null @@ -1,11 +0,0 @@ -class sudo::linux inherits sudo::base { - package{'sudo': - ensure => installed, - } - - if $sudo_deploy_sudoers { - File['/etc/sudoers']{ - require => Package['sudo'], - } - } -}