From 8c1b10374bf8b6fd75bc0110b31d91badc84a981 Mon Sep 17 00:00:00 2001 From: Tom De Vylder Date: Tue, 27 Nov 2012 17:30:46 +0100 Subject: Code smell --- manifests/config.pp | 7 ++++--- manifests/export.pp | 2 +- manifests/init.pp | 1 + manifests/params.pp | 3 ++- manifests/service.pp | 37 +++++++++++++------------------------ 5 files changed, 21 insertions(+), 29 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index a9e5222..33bdf29 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -11,9 +11,10 @@ class nfs::config { if $::nfs::server { concat { $::nfs::config_file: - group => $::nfs::config_group, - mode => $::nfs::config_mode, - owner => $::nfs::config_user, + group => $::nfs::config_group, + mode => $::nfs::config_mode, + owner => $::nfs::config_user, + notify => Service[$::nfs::service_name], } concat::fragment { 'export_header': diff --git a/manifests/export.pp b/manifests/export.pp index 9584255..c4c08dd 100644 --- a/manifests/export.pp +++ b/manifests/export.pp @@ -4,7 +4,7 @@ define nfs::export ( $export_directory, $export_target, $ensure = present, - $export_options = 'no_root_squash', + $export_options = 'rw,no_root_squash,no_subtree_check', ) { if ! $::nfs::server { diff --git a/manifests/init.pp b/manifests/init.pp index ff197d4..019dcac 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,6 +17,7 @@ class nfs ( $service_ensure = $::nfs::params::service_ensure, $service_hasstatus = $::nfs::params::service_hasstatus, $service_name = $::nfs::params::service_name, + $service_rpc = $::nfs::params::service_rpc, ) inherits nfs::params { include nfs::install diff --git a/manifests/params.pp b/manifests/params.pp index db46c24..5c9e961 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,6 +20,7 @@ class nfs::params { $service_hasrestart = true $service_hasstatus = true $service_name = 'nfs' + $service_rpc = 'rpcbind' } 'Debian', 'Ubuntu': { @@ -36,12 +37,12 @@ class nfs::params { $service_hasrestart = true $service_hasstatus = true $service_name = 'nfs-kernel-server' + $service_rpc = 'portmap' } default: { fail "Operating system ${::operatingsystem} is not supported yet." } } - } diff --git a/manifests/service.pp b/manifests/service.pp index e012fe6..9c963bd 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -2,32 +2,21 @@ # class nfs::service { if $::nfs::server { + Service { + require => Class['::nfs::config'], + } - if $::osfamily == 'RedHat' { - - service { 'rpcbind': - ensure => $::nfs::service_ensure, - enable => $::nfs::service_enable, - hasstatus => $::nfs::service_hasstatus, - require => Class['::nfs::config']; - } - - service { $::nfs::service_name: - ensure => $::nfs::service_ensure, - enable => $::nfs::service_enable, - hasstatus => $::nfs::service_hasstatus, - require => [ Class['::nfs::config'], Service['rpcbind'], ]; - } - - } else { - - service { $::nfs::service_name: - ensure => $::nfs::service_ensure, - enable => $::nfs::service_enable, - hasstatus => $::nfs::service_hasstatus, - require => Class['::nfs::config']; - } + service { $::nfs::service_rpc: + ensure => $::nfs::service_ensure, + enable => $::nfs::service_enable, + hasstatus => $::nfs::service_hasstatus; + } + service { $::nfs::service_name: + ensure => $::nfs::service_ensure, + enable => $::nfs::service_enable, + hasstatus => $::nfs::service_hasstatus, + require => Service[$::nfs::service_rpc]; } } } -- cgit v1.2.3