diff --git a/Gemfile b/Gemfile index d0d980d..189b7c5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,9 @@ source 'https://rubygems.org' -puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3'] +puppetversion = ENV.key?('PUPPET_GEM_VERSION') ? "#{ENV['PUPPET_GEM_VERSION']}" : ['>= 3.3'] +facterversion = ENV.key?('FACTER_GEM_VERSION') ? "#{ENV['FACTER_GEM_VERSION']}" : ['>= 1.7'] gem 'puppet', puppetversion gem 'puppetlabs_spec_helper', '>= 0.1.0' gem 'puppet-lint', '>= 0.3.2' -gem 'facter', '>= 1.7.0' \ No newline at end of file +gem 'facter', facterversion +gem 'rspec', '< 3.2.0' 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 dadc6d1..b9328a7 100644 --- a/spec/defines/client_spec.rb +++ b/spec/defines/client_spec.rb @@ -1,10 +1,30 @@ require 'spec_helper' describe 'nfs::client::mount', :type => :define do - let(:title) { '/srv/test' } - let(:facts) { { :operatingsystem => 'ubuntu' } } - let(:params) {{ :server => 'nfs.int.net', :share => '/srv/share' } } - it do - should contain_class('nfs::client') + context "Mount created by exported resource" do + let(:title) { 'shared /srv/test by nfs.int.net' } + let(:facts) { { :operatingsystem => 'ubuntu', :clientcert => 'test.example.com' } } + let(:params) {{ + :server => 'nfs.int.net', + :share => '/srv/share', + :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', :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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2c6f566..97d21e8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' + +class Undef + def inspect + 'undef' + end +end