diff --git a/manifests/client.pp b/manifests/client.pp index fe16f19..94e536a 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -44,9 +44,10 @@ $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain ) inherits nfs::params { - class{ "nfs::client::${osfamily}": - nfs_v4 => $nfs_v4, - nfs_v4_idmap_domain => $nfs_v4_idmap_domain, - } + include "::nfs::client::${osfamily}" + Class["::nfs::client::${osfamily}::install"] -> + Class["::nfs::client::${osfamily}::configure"] -> + Class["::nfs::client::${osfamily}"] -> + Class['::nfs::client'] } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 617f630..e3bf80a 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -2,5 +2,5 @@ $nfs_v4 = false, $nfs_v4_idmap_domain = undef ) { - + fail("NFS client is not supported on Darwin") } diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 03c6203..816fdaa 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,10 +1,9 @@ class nfs::client::debian ( - $nfs_v4 = false, - $nfs_v4_idmap_domain = undef + $nfs_v4 = $::nfs::client::nfs_v4, + $nfs_v4_idmap_domain = $::nfs::client::nfs_v4_idmap_domain, ) { include nfs::client::debian::install, nfs::client::debian::configure, nfs::client::debian::service - } diff --git a/manifests/client/mount.pp b/manifests/client/mount.pp index 0588bc6..74eb91a 100644 --- a/manifests/client/mount.pp +++ b/manifests/client/mount.pp @@ -32,7 +32,7 @@ ) { include nfs::client - + Class["nfs::client"] -> Nfs::Client::Mount["$title"] if $nfs::client::nfs_v4 == true { diff --git a/manifests/client/redhat.pp b/manifests/client/redhat.pp index 257e780..34544af 100644 --- a/manifests/client/redhat.pp +++ b/manifests/client/redhat.pp @@ -2,13 +2,11 @@ # refactored a bit class nfs::client::redhat ( - $nfs_v4 = false, - $nfs_v4_idmap_domain = undef + $nfs_v4 = $::nfs::client::nfs_v4, + $nfs_v4_idmap_domain = $::nfs::client::nfs_v4_idmap_domain, ) inherits nfs::client::redhat::params { - include nfs::client::redhat::install, - nfs::client::redhat::configure, + include nfs::client::redhat::install, + nfs::client::redhat::configure, nfs::client::redhat::service - - } diff --git a/manifests/mkdir.pp b/manifests/mkdir.pp index 9192103..82274f2 100644 --- a/manifests/mkdir.pp +++ b/manifests/mkdir.pp @@ -1,16 +1,16 @@ # Nasty ass hax to allow several levels of directories +# Ensures the directory exists in the catalag define nfs::mkdir() { + if ! defined (File[$name]) { + exec { "mkdir_recurse_${name}" : + path => [ '/bin', '/usr/bin' ], + command => "mkdir -p ${name}", + unless => "test -d ${name}", + } - exec { "mkdir_recurse_${name}": - path => [ '/bin', '/usr/bin' ], - command => "mkdir -p ${name}", - unless => "test -d ${name}", - } - - file { - "${name}": - ensure => directory, - require => Exec["mkdir_recurse_${name}"] - } - -} + file { $name : + ensure => directory, + require => Exec["mkdir_recurse_${name}"] + } + } +} \ No newline at end of file diff --git a/manifests/server/export.pp b/manifests/server/export.pp index 7fe1bb0..1fb2aec 100644 --- a/manifests/server/export.pp +++ b/manifests/server/export.pp @@ -1,7 +1,7 @@ define nfs::server::export ( $v3_export_name = $name, $v4_export_name = regsubst($name, '.*/(.*)', '\1' ), - $clients = 'localhost(ro)', + $clients = ['localhost(ro)'], $bind = 'rbind', # globals for this share # propogated to storeconfigs diff --git a/manifests/server/export/configure.pp b/manifests/server/export/configure.pp index 220a534..c8d1ff2 100644 --- a/manifests/server/export/configure.pp +++ b/manifests/server/export/configure.pp @@ -4,7 +4,7 @@ ) { if $ensure != 'absent' { - $line = "${name} ${clients}\n" + $line = sprintf("%s %s\n", $name, join($clients, " ")) concat::fragment{ "${name}": diff --git a/spec/defines/server_export_spec.rb b/spec/defines/server_export_spec.rb index ed62e23..b958b98 100644 --- a/spec/defines/server_export_spec.rb +++ b/spec/defines/server_export_spec.rb @@ -3,7 +3,16 @@ describe 'nfs::server::export' do let(:title) { '/srv/test' } - #let(:params) {{ :server => 'nfs.int.net', :share => '/srv/share' } } + let(:params) {{ + #:server => 'nfs.int.net', + #:share => '/srv/share' + :clients => [ + 'localhost(ro)', + '$network}/$netmask(rw,async,all_squash,anonuid=99,anongid=99)', + 'nfsclient(ro)', + ] + }} + let(:facts){{:concat_basedir => '/var/lib/puppet/concat',}} it do should contain_nfs__server__export__configure('/srv/test') end