From a0d94615dc914367a081e2976d25a60f8061753f Mon Sep 17 00:00:00 2001 From: Seb Dangerfield Date: Fri, 27 Mar 2015 11:02:15 +0000 Subject: [PATCH] Fixing naming of nfs exports when leaving $mount param as default --- manifests/server/export.pp | 8 +++++++- spec/defines/client_spec.rb | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/manifests/server/export.pp b/manifests/server/export.pp index 64814ea..ae4b17f 100644 --- a/manifests/server/export.pp +++ b/manifests/server/export.pp @@ -50,9 +50,15 @@ clients => $clients, } + if $mount == undef { + $_mount = $v3_export_name + } else { + $_mount = $mount + } + @@nfs::client::mount {"shared ${v3_export_name} by ${::clientcert}": ensure => $ensure, - mount => $mount, + mount => $_mount, remounts => $remounts, atboot => $atboot, options => $options, diff --git a/spec/defines/client_spec.rb b/spec/defines/client_spec.rb index 83d5cf4..b9328a7 100644 --- a/spec/defines/client_spec.rb +++ b/spec/defines/client_spec.rb @@ -3,25 +3,28 @@ describe 'nfs::client::mount', :type => :define do context "Mount created by exported resource" do let(:title) { 'shared /srv/test by nfs.int.net' } - let(:facts) { { :operatingsystem => 'ubuntu' } } + let(:facts) { { :operatingsystem => 'ubuntu', :clientcert => 'test.example.com' } } let(:params) {{ :server => 'nfs.int.net', :share => '/srv/share', - :mount => Undef.new + :mount => '/srv/share' }} it do should compile should contain_class('nfs::client') + should contain_mount('shared nfs.int.net:/srv/share by test.example.com /srv/share') end end context "Mount manually set" do let(:title) { '/srv/test' } - let(:facts) { { :operatingsystem => 'ubuntu' } } + let(:facts) { { :operatingsystem => 'ubuntu', :clientcert => 'test.example.com' } } let(:params) {{ :server => 'nfs.int.net', :share => '/srv/share' } } it do should compile should contain_class('nfs::client') + should contain_mount('shared nfs.int.net:/srv/share by test.example.com /srv/test') + #should contain_mount('/srv/test') end end end