From af392886da985e65228428d3e08cea7af535522d Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Fri, 13 Dec 2013 15:42:32 +0100 Subject: [PATCH 1/6] fix: changed clients type from string to array --- manifests/server/export.pp | 2 +- manifests/server/export/configure.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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}": From ffc2203f51ef70a2ab00de384161e892aab93308 Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Mon, 16 Dec 2013 09:36:06 +0100 Subject: [PATCH 2/6] adjusted spec for exports (clients passed as array) --- spec/defines/server_export_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 From 8dd4dced25db171384729168fc59f10e3887a9a8 Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Fri, 7 Feb 2014 16:46:27 +0100 Subject: [PATCH 3/6] Added ordering needed by nfs::client::mount --- manifests/client.pp | 4 ++++ manifests/client/mount.pp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/manifests/client.pp b/manifests/client.pp index fe16f19..37a3bf5 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -49,4 +49,8 @@ nfs_v4_idmap_domain => $nfs_v4_idmap_domain, } + Class["::nfs::client::${osfamily}::install"] -> + Class["::nfs::client::${osfamily}::configure"] -> + Class["::nfs::client::${osfamily}"] -> + Class['::nfs::client'] } 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 { From 801f64e5ceb04a9117926d2e0b57cbf2ce2bdd45 Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Wed, 19 Mar 2014 09:17:05 +0100 Subject: [PATCH 4/6] mkdir now only ensures the directory is in the catalog, the were conflicts, when the directory was already created by another manifests --- manifests/mkdir.pp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 From 9f79151d95ae5c29acc6648e834b513dfbe29601 Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Wed, 16 Apr 2014 12:56:27 +0200 Subject: [PATCH 5/6] fix: added fail message: darwin not supported --- manifests/client/darwin.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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") } From cc82b7560bb29970057fd7e0529257fd0001b5a7 Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Wed, 16 Apr 2014 12:58:32 +0200 Subject: [PATCH 6/6] upd: nfs::client now includes nfs::client:${osfamily}, needed to install both server and client on the same node --- manifests/client.pp | 5 +---- manifests/client/debian.pp | 5 ++--- manifests/client/redhat.pp | 10 ++++------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 37a3bf5..94e536a 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -44,10 +44,7 @@ $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"] -> 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/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 - - }