From 20085c8866294ab0b3c05d514f03e9819f4900b2 Mon Sep 17 00:00:00 2001 From: Philipp Tölke Date: Thu, 9 Jun 2016 15:44:11 +0200 Subject: Add parameter to disable automatic join of domain --- manifests/server/ads.pp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 757d091..d7d462c 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -21,7 +21,8 @@ class samba::server::ads($ensure = present, $map_system = 'no', $map_archive = 'no', $map_readonly = 'no', - $target_ou = 'Nix_Mashine') { + $target_ou = 'Nix_Mashine', + $perform_join = true) { $krb5_user_package = $::osfamily ? { 'RedHat' => 'krb5-workstation', @@ -122,10 +123,12 @@ class samba::server::ads($ensure = present, 'samba-winbind use default domain'], Service['winbind'] ], } - exec {'join-active-directory': - # join the domain configured in samba.conf - command => '/sbin/configure_active_directory -j', - unless => '/sbin/verify_active_directory', - require => [ File['configure_active_directory', 'verify_active_directory'], Service['winbind'] ], + if ($perform_join) { + exec {'join-active-directory': + # join the domain configured in samba.conf + command => '/sbin/configure_active_directory -j', + unless => '/sbin/verify_active_directory', + require => [ File['configure_active_directory', 'verify_active_directory'], Service['winbind'] ], + } } } -- cgit v1.2.3 From 96e8a1b73f8d0c997fffc090a7b9c4a59f8385eb Mon Sep 17 00:00:00 2001 From: Philipp Toelke Date: Fri, 1 Jul 2016 17:00:41 +0200 Subject: fix templates so that specs can use them; --- templates/configure_active_directory.erb | 2 +- templates/verify_active_directory.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/configure_active_directory.erb b/templates/configure_active_directory.erb index 4f9b6e0..1e74560 100644 --- a/templates/configure_active_directory.erb +++ b/templates/configure_active_directory.erb @@ -57,7 +57,7 @@ done password='<%= scope.lookupvar('samba::server::ads::winbind_pass') -%>' # short hostname from facter -my_hostname="<%= hostname -%>" +my_hostname="<%= @hostname -%>" # what account do we use for net ads commands? winbind_acct="<%= scope.lookupvar('samba::server::ads::winbind_acct') -%>" diff --git a/templates/verify_active_directory.erb b/templates/verify_active_directory.erb index 0917c49..c88d6a4 100644 --- a/templates/verify_active_directory.erb +++ b/templates/verify_active_directory.erb @@ -24,7 +24,7 @@ fi password='<%= scope.lookupvar('samba::server::ads::winbind_pass') -%>' # short hostname from facter -my_hostname="<%= hostname -%>" +my_hostname="<%= @hostname -%>" winbind_acct="<%= scope.lookupvar('samba::server::ads::winbind_acct') -%>" -- cgit v1.2.3 From 22c8f66ffaee96ab61465331d0d14636e5312ae6 Mon Sep 17 00:00:00 2001 From: Philipp Toelke Date: Fri, 1 Jul 2016 17:02:30 +0200 Subject: add spec for disable/enable join refs ajjahn/puppet-samba#61 --- spec/classes/samba__server__ads_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/classes/samba__server__ads_spec.rb diff --git a/spec/classes/samba__server__ads_spec.rb b/spec/classes/samba__server__ads_spec.rb new file mode 100644 index 0000000..a174bef --- /dev/null +++ b/spec/classes/samba__server__ads_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe 'samba::server::ads', :type => :class do + let( :facts ) { { :osfamily => 'Debian' } } + context "Default config" do + it { should contain_exec('join-active-directory') } + end + + context "No join" do + let ( :params ) { { 'perform_join' => false }} + it { should_not contain_exec('join-active-directory') } + end + + context "Join 'forced'" do + let ( :params ) { { 'perform_join' => true }} + it { should contain_exec('join-active-directory') } + end +end + -- cgit v1.2.3 From 3ffd1bcbc1d203ad814038483cd49d332bbb7618 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 1 Jul 2016 11:51:42 -0400 Subject: Pin json_pure below 2.0.0 for 1.8.7 support --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index a89c9e6..f90407b 100755 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ group :test do gem "rspec", '< 3.2.0' gem "rspec-core", "3.1.7" gem "rspec-puppet", "~> 2.1" + gem "json_pure", "< 2.0.0" gem "puppet-syntax" gem "puppetlabs_spec_helper" -- cgit v1.2.3 From ac7073b8633b361788cc6a2d08f42a8cc532593f Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Tue, 28 Jun 2016 23:42:10 +1000 Subject: Adding the option for setting root preexec on a share --- manifests/server/share.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b0690bb..d93cc0b 100755 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -30,6 +30,7 @@ define samba::server::share($ensure = present, $store_dos_attributes = '', $strict_allocate = '', $hide_dot_files = '', + $root_preexec = '', ) { $incl = $samba::server::incl @@ -183,6 +184,10 @@ define samba::server::share($ensure = present, false => "set \"${target}/hide dot files\" no", default => "rm \"${target}/hide dot files\"", }, + $root_preexec ? { + '' => "rm \"${target}/root preexec\"", + default => "set \"${target}/root preexec\" '${root_preexec}'", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From 52b8916a8754f397dfc65e055f52d10905e42d74 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 6 Jul 2016 00:03:45 +1000 Subject: Initial tests for samba::share --- .rspec | 2 + Gemfile | 1 + spec/defines/samba__server__share_spec.rb | 103 ++++++++++++++++++++++++++++++ spec/spec.opts | 6 ++ spec/spec_helper.rb | 3 + 5 files changed, 115 insertions(+) create mode 100644 .rspec create mode 100644 spec/defines/samba__server__share_spec.rb create mode 100644 spec/spec.opts diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..8c18f1a --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/Gemfile b/Gemfile index f90407b..598a68f 100755 --- a/Gemfile +++ b/Gemfile @@ -24,4 +24,5 @@ group :test do gem "puppet-syntax" gem "puppetlabs_spec_helper" + gem 'rspec-puppet-facts' end diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb new file mode 100644 index 0000000..e6b24b8 --- /dev/null +++ b/spec/defines/samba__server__share_spec.rb @@ -0,0 +1,103 @@ +require 'spec_helper' + +describe 'samba::server::share', :type => :define do + let(:pre_condition){ 'class{"samba::server":}'} + on_supported_os.each do |os, facts| + context "When on an #{os} system" do + let(:facts) do + facts.merge({ + :concat_basedir => '/tmp', + :domain => 'domain.com' + }) + end + + context 'when called with base options' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present' + }} + + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"] + ).that_requires('Class[Samba::Server::Config]' + ).that_notifies('Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + ).that_requires('Class[Samba::Server::Config]' + ).that_notifies('Class[Samba::Server::Service]') + } + end#no params + + context 'when called with ensure set to absent' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'absent' + }} + + it 'should not contain the share' do + skip 'this is not working' + should_not contain_samba__server__share('test_share') + end + end#no params + + context 'when called with available set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :available => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"] + ).that_requires('Class[Samba::Server::Config]' + ).that_notifies('Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set \"target[. = 'test_share']/available\" yes"] + ).that_requires('Class[Samba::Server::Config]' + ).that_notifies('Class[Samba::Server::Service]') + } + end#no params + + context 'when called with root_preexec set to something' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :root_preexec => '/bin/true', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"] + ).that_requires('Class[Samba::Server::Config]' + ).that_notifies('Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set \"target[. = 'test_share']/root_preexec\" /bin/true"] + ).that_requires('Class[Samba::Server::Config]' + ).that_notifies('Class[Samba::Server::Service]') + } + end#no params + + end + end +end + diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 0000000..91cd642 --- /dev/null +++ b/spec/spec.opts @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 81f98ac..ee10669 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' + +include RspecPuppetFacts RSpec.configure do |c| c.before do -- cgit v1.2.3 From 00c1f835a7bb60a104cea3c8c70b43646de2bd91 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 6 Jul 2016 00:23:46 +1000 Subject: Fix requires and notify --- spec/defines/samba__server__share_spec.rb | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index e6b24b8..26c39a1 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -22,16 +22,16 @@ describe 'samba::server::share', :type => :define do :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"] - ).that_requires('Class[Samba::Server::Config]' - ).that_notifies('Class[Samba::Server::Service]') + :changes => ["set target[. = 'test_share'] 'test_share'"], + :requires => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') } it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - ).that_requires('Class[Samba::Server::Config]' - ).that_notifies('Class[Samba::Server::Service]') + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :requires => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') } end#no params @@ -58,17 +58,17 @@ describe 'samba::server::share', :type => :define do :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"] - ).that_requires('Class[Samba::Server::Config]' - ).that_notifies('Class[Samba::Server::Service]') + :changes => ["set target[. = 'test_share'] 'test_share'"], + :requires => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') } it { is_expected.to contain_augeas('test_share-changes').with( :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set \"target[. = 'test_share']/available\" yes"] - ).that_requires('Class[Samba::Server::Config]' - ).that_notifies('Class[Samba::Server::Service]') + :changes => ["set \"target[. = 'test_share']/available\" yes"], + :requires => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') } end#no params @@ -83,17 +83,17 @@ describe 'samba::server::share', :type => :define do :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"] - ).that_requires('Class[Samba::Server::Config]' - ).that_notifies('Class[Samba::Server::Service]') + :changes => ["set target[. = 'test_share'] 'test_share'"], + :requires => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') } it { is_expected.to contain_augeas('test_share-changes').with( :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set \"target[. = 'test_share']/root_preexec\" /bin/true"] - ).that_requires('Class[Samba::Server::Config]' - ).that_notifies('Class[Samba::Server::Service]') + :changes => ["set \"target[. = 'test_share']/root_preexec\" /bin/true"], + :requires => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') } end#no params -- cgit v1.2.3 From 2229e9dcaf7ab7e82a77a7421deb8879e1204de6 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 6 Jul 2016 03:36:29 +1000 Subject: Adding tests for more share settings --- manifests/server/share.pp | 12 +- spec/defines/samba__server__share_spec.rb | 1076 ++++++++++++++++++++++++++++- 2 files changed, 1061 insertions(+), 27 deletions(-) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index d93cc0b..be4ee1e 100755 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -160,23 +160,23 @@ define samba::server::share($ensure = present, default => "rm \"${target}/strict allocate\"", }, $valid_users ? { - '' => "rm \"${target}/valid users\"", + '' => "rm \"${target}/valid users\"", default => "set \"${target}/valid users\" '${valid_users}'", }, $op_locks ? { - '' => "rm \"${target}/oplocks\"", + '' => "rm \"${target}/oplocks\"", default => "set \"${target}/oplocks\" '${op_locks}'", }, $level2_oplocks ? { - '' => "rm \"${target}/level2 oplocks\"", + '' => "rm \"${target}/level2 oplocks\"", default => "set \"${target}/level2 oplocks\" '${level2_oplocks}'", }, $veto_oplock_files ? { - '' => "rm \"${target}/veto oplock files\"", + '' => "rm \"${target}/veto oplock files\"", default => "set \"${target}/veto oplock files\" '${veto_oplock_files}'", }, $write_list ? { - '' => "rm \"${target}/write list\"", + '' => "rm \"${target}/write list\"", default => "set \"${target}/write list\" '${write_list}'", }, $hide_dot_files ? { @@ -185,7 +185,7 @@ define samba::server::share($ensure = present, default => "rm \"${target}/hide dot files\"", }, $root_preexec ? { - '' => "rm \"${target}/root preexec\"", + '' => "rm \"${target}/root preexec\"", default => "set \"${target}/root preexec\" '${root_preexec}'", }, ] diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 26c39a1..656b8b0 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -2,7 +2,23 @@ require 'spec_helper' describe 'samba::server::share', :type => :define do let(:pre_condition){ 'class{"samba::server":}'} - on_supported_os.each do |os, facts| + on_supported_os({ + :hardwaremodels => ['x86_64'], + :supported_os => [ + { + "operatingsystem" => "Ubuntu", + "operatingsystemrelease" => [ + "14.04" + ] + }, + { + "operatingsystem" => "CentOS", + "operatingsystemrelease" => [ + "7" + ] + } + ], + }).each do |os, facts| context "When on an #{os} system" do let(:facts) do facts.merge({ @@ -23,14 +39,14 @@ describe 'samba::server::share', :type => :define do :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', :changes => ["set target[. = 'test_share'] 'test_share'"], - :requires => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') } it { is_expected.to contain_augeas('test_share-changes').with( :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :requires => 'Augeas[test_share-section]', + :require => 'Augeas[test_share-section]', :notify => 'Class[Samba::Server::Service]') } end#no params @@ -41,10 +57,14 @@ describe 'samba::server::share', :type => :define do :ensure => 'absent' }} - it 'should not contain the share' do - skip 'this is not working' - should_not contain_samba__server__share('test_share') - end + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["rm target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } end#no params context 'when called with available set to true' do @@ -59,20 +79,219 @@ describe 'samba::server::share', :type => :define do :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', :changes => ["set target[. = 'test_share'] 'test_share'"], - :requires => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') } it { is_expected.to contain_augeas('test_share-changes').with( :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set \"target[. = 'test_share']/available\" yes"], - :requires => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') + :changes => [ + "set \"target[. = 'test_share']/available\" yes", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') } - end#no params + end#available true + + context 'when called with available set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :available => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "set \"target[. = 'test_share']/available\" no", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#available false + + context 'when called with browsable set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :browsable => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "set \"target[. = 'test_share']/browsable\" yes", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#browsable false - context 'when called with root_preexec set to something' do + context 'when called with browsable set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :browsable => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "set \"target[. = 'test_share']/browsable\" no", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#browsable false + + context 'when called with root_preexec set to /bin/true' do let(:title) { 'test_share' } let(:params) {{ :ensure => 'present', @@ -84,18 +303,833 @@ describe 'samba::server::share', :type => :define do :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', :changes => ["set target[. = 'test_share'] 'test_share'"], - :requires => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') } it { is_expected.to contain_augeas('test_share-changes').with( :incl => '/etc/samba/smb.conf', :lens => 'Samba.lns', :context => '/files/etc/samba/smb.conf', - :changes => ["set \"target[. = 'test_share']/root_preexec\" /bin/true"], - :requires => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "set \"target[. = 'test_share']/root preexec\" '/bin/true'" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') } - end#no params + end#root_preexec + + context 'when called with comment set to "testing testing"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :comment => 'testing testing', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "set \"target[. = 'test_share']/comment\" 'testing testing'", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#comment + + context 'when called with copy set to "testing testing"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :copy => 'testing testing', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "set \"target[. = 'test_share']/copy\" 'testing testing'", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#copy + + context 'when called with create_mask set to "755"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :create_mask => '755', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "set \"target[. = 'test_share']/create mask\" '755'", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#create mask + + context 'when called with directory_mask set to "755"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :directory_mask => '755', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "set \"target[. = 'test_share']/directory mask\" '755'", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#directory_mask + + context 'when called with force_create_mask set to "755"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :force_create_mask => '755', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "set \"target[. = 'test_share']/force create mask\" '755'", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#force_create_mask + + context 'when called with force_directory_mode set to "755"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :force_directory_mode => '755', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "set \"target[. = 'test_share']/force directory mode\" '755'", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#force_directory_mode + + context 'when called with force_group set to "nogroup"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :force_group => 'nogroup', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "set \"target[. = 'test_share']/force group\" 'nogroup'", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#force_group + + context 'when called with force_user set to "nobody"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :force_user => 'nobody', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "set \"target[. = 'test_share']/force user\" 'nobody'", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#force_user + + context 'when called with guest_ok set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :guest_ok => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "set \"target[. = 'test_share']/guest ok\" yes", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#guest_ok true + + context 'when called with guest_ok set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :guest_ok => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "set \"target[. = 'test_share']/guest ok\" no", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#guest_ok false + + context 'when called with guest_only set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :guest_only => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "set \"target[. = 'test_share']/guest only\" yes", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#guest_only false + + context 'when called with guest_only set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :guest_only => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "set \"target[. = 'test_share']/guest only\" no", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#guest_only false + + context 'when called with hide_unreadable set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :hide_unreadable => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "set \"target[. = 'test_share']/hide unreadable\" yes", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#hide_unreadable true + + context 'when called with hide_unreadable set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :hide_unreadable => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "set \"target[. = 'test_share']/hide unreadable\" no", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#hide_unreadable false end end -- cgit v1.2.3 From e92eee3eece276daa4d115bca7d7af71c5838005 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Fri, 8 Jul 2016 01:26:27 +1000 Subject: Add tests for the rest of the options --- spec/defines/samba__server__share_spec.rb | 1512 +++++++++++++++++++++++++++++ spec/spec_helper.rb | 2 + 2 files changed, 1514 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 656b8b0..2fd088c 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -1131,6 +1131,1518 @@ describe 'samba::server::share', :type => :define do } end#hide_unreadable false + context 'when called with path set to /tmp' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :path => '/tmp', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "set target[. = 'test_share']/path '/tmp'", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#path + + context 'when called with read_only set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :read_only => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "set \"target[. = 'test_share']/read only\" yes", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#read_only true + + context 'when called with read_only set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :read_only => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "set \"target[. = 'test_share']/read only\" no", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#read_only false + + context 'when called with public set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :public => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "set \"target[. = 'test_share']/public\" yes", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#public true + + context 'when called with public set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :public => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "set \"target[. = 'test_share']/public\" no", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#public false + + context 'when called with writable set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :writable => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "set \"target[. = 'test_share']/writable\" yes", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#writable true + + context 'when called with writable set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :writable => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "set \"target[. = 'test_share']/writable\" no", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#writable false + + context 'when called with printable set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :printable => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "set \"target[. = 'test_share']/printable\" yes", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#printable true + + context 'when called with printable set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :printable => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "set \"target[. = 'test_share']/printable\" no", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#printable false + + context 'when called with follow_symlinks set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :follow_symlinks => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "set \"target[. = 'test_share']/follow symlinks\" yes", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#follow_symlinks true + + context 'when called with follow_symlinks set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :follow_symlinks => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "set \"target[. = 'test_share']/follow symlinks\" no", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#follow_symlinks false + + context 'when called with wide_links set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :wide_links => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "set \"target[. = 'test_share']/wide links\" yes", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#wide_links true + + context 'when called with wide_links set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :wide_links => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "set \"target[. = 'test_share']/wide links\" no", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#wide_links false + + context 'when called with map_acl_inherit set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :map_acl_inherit => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "set \"target[. = 'test_share']/map acl inherit\" yes", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#map_acl_inherit true + + context 'when called with map_acl_inherit set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :map_acl_inherit => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "set \"target[. = 'test_share']/map acl inherit\" no", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#map_acl_inherit false + + context 'when called with store_dos_attributes set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :store_dos_attributes => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "set \"target[. = 'test_share']/store dos attributes\" yes", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#store_dos_attributes true + + context 'when called with store_dos_attributes set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :store_dos_attributes => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "set \"target[. = 'test_share']/store dos attributes\" no", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#store_dos_attributes false + + context 'when called with strict_allocate set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :strict_allocate => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "set \"target[. = 'test_share']/strict allocate\" yes", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#strict_allocate true + + context 'when called with strict_allocate set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :strict_allocate => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "set \"target[. = 'test_share']/strict allocate\" no", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#strict_allocate false + + context 'when called with valid_users set to "bill,ben"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :valid_users => 'bill,ben', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "set \"target[. = 'test_share']/valid users\" 'bill,ben'", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#valid_users + + context 'when called with op_locks set to "testing"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :op_locks => 'testing', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "set \"target[. = 'test_share']/oplocks\" 'testing'", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#op_locks + + context 'when called with level2_oplocks set to "testing"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :level2_oplocks => 'testing', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "set \"target[. = 'test_share']/level2 oplocks\" 'testing'", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#level2_oplocks + + context 'when called with veto_oplock_files set to "testing"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :veto_oplock_files => 'testing', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "set \"target[. = 'test_share']/veto oplock files\" 'testing'", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#veto_oplock_files + + context 'when called with write_list set to "bill,ben"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :write_list => 'bill,ben', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "set \"target[. = 'test_share']/write list\" 'bill,ben'", + "rm \"target[. = 'test_share']/hide dot files\"", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#write_list + + context 'when called with hide_dot_files set to true' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :hide_dot_files => true, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "set \"target[. = 'test_share']/hide dot files\" yes", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#hide_dot_files true + + context 'when called with hide_dot_files set to false' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :hide_dot_files => false, + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "set \"target[. = 'test_share']/hide dot files\" no", + "rm \"target[. = 'test_share']/root preexec\"" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#hide_dot_files false + + context 'when called with root_preexec set to "/bin/test"' do + let(:title) { 'test_share' } + let(:params) {{ + :ensure => 'present', + :root_preexec => '/bin/test', + }} + it { is_expected.to contain_samba__server__share('test_share') } + it { is_expected.to contain_augeas('test_share-section').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = 'test_share'] 'test_share'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas('test_share-changes').with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => [ + "rm \"target[. = 'test_share']/available\"", + "rm \"target[. = 'test_share']/browsable\"", + "rm \"target[. = 'test_share']/comment\"", + "rm \"target[. = 'test_share']/copy\"", + "rm \"target[. = 'test_share']/create mask\"", + "rm \"target[. = 'test_share']/directory mask\"", + "rm \"target[. = 'test_share']/force create mask\"", + "rm \"target[. = 'test_share']/force directory mode\"", + "rm \"target[. = 'test_share']/force group\"", + "rm \"target[. = 'test_share']/force user\"", + "rm \"target[. = 'test_share']/guest ok\"", + "rm \"target[. = 'test_share']/guest only\"", + "rm \"target[. = 'test_share']/hide unreadable\"", + "rm target[. = 'test_share']/path", + "rm \"target[. = 'test_share']/read only\"", + "rm \"target[. = 'test_share']/public\"", + "rm \"target[. = 'test_share']/writable\"", + "rm \"target[. = 'test_share']/printable\"", + "rm \"target[. = 'test_share']/follow symlinks\"", + "rm \"target[. = 'test_share']/wide links\"", + "rm \"target[. = 'test_share']/map acl inherit\"", + "rm \"target[. = 'test_share']/store dos attributes\"", + "rm \"target[. = 'test_share']/strict allocate\"", + "rm \"target[. = 'test_share']/valid users\"", + "rm \"target[. = 'test_share']/oplocks\"", + "rm \"target[. = 'test_share']/level2 oplocks\"", + "rm \"target[. = 'test_share']/veto oplock files\"", + "rm \"target[. = 'test_share']/write list\"", + "rm \"target[. = 'test_share']/hide dot files\"", + "set \"target[. = 'test_share']/root preexec\" '/bin/test'" + ], + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } + end#root_preexec + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ee10669..c864359 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,3 +9,5 @@ RSpec.configure do |c| Puppet.features.stubs(:root? => true) end end + +at_exit { RSpec::Puppet::Coverage.report! } -- cgit v1.2.3 From f0095397fd8a61367d39ae76bf63fb1c48885bbc Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:05:48 -0400 Subject: implement helpers and reduce test duplication --- spec/defines/samba__server__share_spec.rb | 2406 ++--------------------------- spec/spec_helper.rb | 2 + spec/support/augeas.rb | 67 + 3 files changed, 219 insertions(+), 2256 deletions(-) create mode 100644 spec/support/augeas.rb diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 2fd088c..a621a15 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -1,5 +1,63 @@ require 'spec_helper' +shared_examples "default share" do + let(:title) { "test_share" } + let(:params) {{ :ensure => 'present' }} + let(:default_changes) do + set = Augeas::TargetedChangeSet.new(title) + set.with("available") + set.with("browsable") + set.with("comment") + set.with("copy") + set.with("create mask") + set.with("directory mask") + set.with("force create mask") + set.with("force directory mode") + set.with("force group") + set.with("force user") + set.with("guest ok") + set.with("guest only") + set.with("hide unreadable") + set.with("path", nil, nil) + set.with("read only") + set.with("public") + set.with("writable") + set.with("printable") + set.with("follow symlinks") + set.with("wide links") + set.with("map acl inherit") + set.with("store dos attributes") + set.with("strict allocate") + set.with("valid users") + set.with("oplocks") + set.with("level2 oplocks") + set.with("veto oplock files") + set.with("write list") + set.with("hide dot files") + set.with("root preexec") + end + let(:change_set) { default_changes } + let(:changes) { change_set.to_a } + + it { is_expected.to contain_samba__server__share(title) } + it { is_expected.to contain_augeas("#{title}-section").with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => ["set target[. = '#{title}'] '#{title}'"], + :require => 'Class[Samba::Server::Config]', + :notify => 'Class[Samba::Server::Service]') + } + it { is_expected.to contain_augeas("#{title}-changes").with( + :incl => '/etc/samba/smb.conf', + :lens => 'Samba.lns', + :context => '/files/etc/samba/smb.conf', + :changes => changes, + :require => 'Augeas[test_share-section]', + :notify => 'Class[Samba::Server::Service]') + } +end + describe 'samba::server::share', :type => :define do let(:pre_condition){ 'class{"samba::server":}'} on_supported_os({ @@ -68,2582 +126,418 @@ describe 'samba::server::share', :type => :define do end#no params context 'when called with available set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :available => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "set \"target[. = 'test_share']/available\" yes", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("available", "yes") } end#available true context 'when called with available set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :available => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "set \"target[. = 'test_share']/available\" no", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("available", "no") } end#available false context 'when called with browsable set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :browsable => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "set \"target[. = 'test_share']/browsable\" yes", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("browsable", "yes") } end#browsable false context 'when called with browsable set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :browsable => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "set \"target[. = 'test_share']/browsable\" no", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("browsable", "no") } end#browsable false context 'when called with root_preexec set to /bin/true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :root_preexec => '/bin/true', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "set \"target[. = 'test_share']/root preexec\" '/bin/true'" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("root preexec", "'/bin/true'") } end#root_preexec context 'when called with comment set to "testing testing"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :comment => 'testing testing', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "set \"target[. = 'test_share']/comment\" 'testing testing'", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("comment", "'testing testing'") } end#comment context 'when called with copy set to "testing testing"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :copy => 'testing testing', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "set \"target[. = 'test_share']/copy\" 'testing testing'", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("copy", "'testing testing'") } end#copy context 'when called with create_mask set to "755"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :create_mask => '755', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "set \"target[. = 'test_share']/create mask\" '755'", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("create mask", "'755'") } end#create mask context 'when called with directory_mask set to "755"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :directory_mask => '755', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "set \"target[. = 'test_share']/directory mask\" '755'", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("directory mask", "'755'") } end#directory_mask context 'when called with force_create_mask set to "755"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :force_create_mask => '755', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "set \"target[. = 'test_share']/force create mask\" '755'", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("force create mask", "'755'") } end#force_create_mask context 'when called with force_directory_mode set to "755"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :force_directory_mode => '755', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "set \"target[. = 'test_share']/force directory mode\" '755'", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("force directory mode", "'755'") } end#force_directory_mode context 'when called with force_group set to "nogroup"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :force_group => 'nogroup', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "set \"target[. = 'test_share']/force group\" 'nogroup'", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("force group", "'nogroup'") } end#force_group context 'when called with force_user set to "nobody"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :force_user => 'nobody', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "set \"target[. = 'test_share']/force user\" 'nobody'", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("force user", "'nobody'") } end#force_user context 'when called with guest_ok set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :guest_ok => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "set \"target[. = 'test_share']/guest ok\" yes", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("guest ok", "yes") } end#guest_ok true context 'when called with guest_ok set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :guest_ok => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "set \"target[. = 'test_share']/guest ok\" no", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("guest ok", "no") } end#guest_ok false context 'when called with guest_only set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :guest_only => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "set \"target[. = 'test_share']/guest only\" yes", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("guest only", "yes") } end#guest_only false context 'when called with guest_only set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :guest_only => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "set \"target[. = 'test_share']/guest only\" no", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("guest only", "no") } end#guest_only false context 'when called with hide_unreadable set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :hide_unreadable => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "set \"target[. = 'test_share']/hide unreadable\" yes", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("hide unreadable", "yes") } end#hide_unreadable true context 'when called with hide_unreadable set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :hide_unreadable => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "set \"target[. = 'test_share']/hide unreadable\" no", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("hide unreadable", "no") } end#hide_unreadable false context 'when called with path set to /tmp' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :path => '/tmp', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "set target[. = 'test_share']/path '/tmp'", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("path", "'/tmp'", nil) } end#path context 'when called with read_only set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :read_only => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "set \"target[. = 'test_share']/read only\" yes", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("read only", "yes") } end#read_only true context 'when called with read_only set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :read_only => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "set \"target[. = 'test_share']/read only\" no", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("read only", "no") } end#read_only false context 'when called with public set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :public => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "set \"target[. = 'test_share']/public\" yes", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("public", "yes") } end#public true context 'when called with public set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :public => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "set \"target[. = 'test_share']/public\" no", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("public", "no") } end#public false context 'when called with writable set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :writable => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "set \"target[. = 'test_share']/writable\" yes", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("writable", "yes") } end#writable true context 'when called with writable set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :writable => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "set \"target[. = 'test_share']/writable\" no", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("writable", "no") } end#writable false context 'when called with printable set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :printable => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "set \"target[. = 'test_share']/printable\" yes", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("printable", "yes") } end#printable true context 'when called with printable set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :printable => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "set \"target[. = 'test_share']/printable\" no", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("printable", "no") } end#printable false context 'when called with follow_symlinks set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :follow_symlinks => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "set \"target[. = 'test_share']/follow symlinks\" yes", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("follow symlinks", "yes") } end#follow_symlinks true context 'when called with follow_symlinks set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :follow_symlinks => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "set \"target[. = 'test_share']/follow symlinks\" no", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("follow symlinks", "no") } end#follow_symlinks false context 'when called with wide_links set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :wide_links => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "set \"target[. = 'test_share']/wide links\" yes", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("wide links", "yes") } end#wide_links true context 'when called with wide_links set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :wide_links => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "set \"target[. = 'test_share']/wide links\" no", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("wide links", "no") } end#wide_links false context 'when called with map_acl_inherit set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :map_acl_inherit => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "set \"target[. = 'test_share']/map acl inherit\" yes", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("map acl inherit", "yes") } end#map_acl_inherit true context 'when called with map_acl_inherit set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :map_acl_inherit => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "set \"target[. = 'test_share']/map acl inherit\" no", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("map acl inherit", "no") } end#map_acl_inherit false context 'when called with store_dos_attributes set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :store_dos_attributes => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "set \"target[. = 'test_share']/store dos attributes\" yes", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("store dos attributes", "yes") } end#store_dos_attributes true context 'when called with store_dos_attributes set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :store_dos_attributes => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "set \"target[. = 'test_share']/store dos attributes\" no", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("store dos attributes", "no") } end#store_dos_attributes false context 'when called with strict_allocate set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :strict_allocate => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "set \"target[. = 'test_share']/strict allocate\" yes", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("strict allocate", "yes") } end#strict_allocate true context 'when called with strict_allocate set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :strict_allocate => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "set \"target[. = 'test_share']/strict allocate\" no", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("strict allocate", "no") } end#strict_allocate false context 'when called with valid_users set to "bill,ben"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :valid_users => 'bill,ben', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "set \"target[. = 'test_share']/valid users\" 'bill,ben'", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("valid users", "'bill,ben'") } end#valid_users context 'when called with op_locks set to "testing"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :op_locks => 'testing', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "set \"target[. = 'test_share']/oplocks\" 'testing'", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("oplocks", "'testing'") } end#op_locks context 'when called with level2_oplocks set to "testing"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :level2_oplocks => 'testing', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "set \"target[. = 'test_share']/level2 oplocks\" 'testing'", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("level2 oplocks", "'testing'") } end#level2_oplocks context 'when called with veto_oplock_files set to "testing"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :veto_oplock_files => 'testing', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "set \"target[. = 'test_share']/veto oplock files\" 'testing'", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("veto oplock files", "'testing'") } end#veto_oplock_files context 'when called with write_list set to "bill,ben"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :write_list => 'bill,ben', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "set \"target[. = 'test_share']/write list\" 'bill,ben'", - "rm \"target[. = 'test_share']/hide dot files\"", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("write list", "'bill,ben'") } end#write_list context 'when called with hide_dot_files set to true' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :hide_dot_files => true, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "set \"target[. = 'test_share']/hide dot files\" yes", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("hide dot files", "yes") } end#hide_dot_files true context 'when called with hide_dot_files set to false' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :hide_dot_files => false, }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "set \"target[. = 'test_share']/hide dot files\" no", - "rm \"target[. = 'test_share']/root preexec\"" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("hide dot files", "no") } end#hide_dot_files false context 'when called with root_preexec set to "/bin/test"' do - let(:title) { 'test_share' } + include_examples "default share" let(:params) {{ :ensure => 'present', :root_preexec => '/bin/test', }} - it { is_expected.to contain_samba__server__share('test_share') } - it { is_expected.to contain_augeas('test_share-section').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => ["set target[. = 'test_share'] 'test_share'"], - :require => 'Class[Samba::Server::Config]', - :notify => 'Class[Samba::Server::Service]') - } - it { is_expected.to contain_augeas('test_share-changes').with( - :incl => '/etc/samba/smb.conf', - :lens => 'Samba.lns', - :context => '/files/etc/samba/smb.conf', - :changes => [ - "rm \"target[. = 'test_share']/available\"", - "rm \"target[. = 'test_share']/browsable\"", - "rm \"target[. = 'test_share']/comment\"", - "rm \"target[. = 'test_share']/copy\"", - "rm \"target[. = 'test_share']/create mask\"", - "rm \"target[. = 'test_share']/directory mask\"", - "rm \"target[. = 'test_share']/force create mask\"", - "rm \"target[. = 'test_share']/force directory mode\"", - "rm \"target[. = 'test_share']/force group\"", - "rm \"target[. = 'test_share']/force user\"", - "rm \"target[. = 'test_share']/guest ok\"", - "rm \"target[. = 'test_share']/guest only\"", - "rm \"target[. = 'test_share']/hide unreadable\"", - "rm target[. = 'test_share']/path", - "rm \"target[. = 'test_share']/read only\"", - "rm \"target[. = 'test_share']/public\"", - "rm \"target[. = 'test_share']/writable\"", - "rm \"target[. = 'test_share']/printable\"", - "rm \"target[. = 'test_share']/follow symlinks\"", - "rm \"target[. = 'test_share']/wide links\"", - "rm \"target[. = 'test_share']/map acl inherit\"", - "rm \"target[. = 'test_share']/store dos attributes\"", - "rm \"target[. = 'test_share']/strict allocate\"", - "rm \"target[. = 'test_share']/valid users\"", - "rm \"target[. = 'test_share']/oplocks\"", - "rm \"target[. = 'test_share']/level2 oplocks\"", - "rm \"target[. = 'test_share']/veto oplock files\"", - "rm \"target[. = 'test_share']/write list\"", - "rm \"target[. = 'test_share']/hide dot files\"", - "set \"target[. = 'test_share']/root preexec\" '/bin/test'" - ], - :require => 'Augeas[test_share-section]', - :notify => 'Class[Samba::Server::Service]') - } + let(:change_set) { default_changes.with("root preexec", "'/bin/test'") } end#root_preexec - end end end - diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c864359..51ef6aa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,8 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' +Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f } + include RspecPuppetFacts RSpec.configure do |c| diff --git a/spec/support/augeas.rb b/spec/support/augeas.rb new file mode 100644 index 0000000..4912e1a --- /dev/null +++ b/spec/support/augeas.rb @@ -0,0 +1,67 @@ +require "delegate" + +module Augeas + class Change + attr_reader :target, :name, :delimiter + + def initialize(target, name, value = nil, delimiter = "\"") + @target = target + @name = name + @value = value + @delimiter = delimiter + end + + def to_s + "#{action} #{delimiter}target[. = '#{target}']/#{name}#{delimiter}#{value}" + end + + def hash + [target, name, Change].hash + end + + def eql?(other) + other.is_a?(self.class) && [other.target, other.name] == [target, name] + end + + private + + def action + return "set" unless @value.nil? + "rm " + end + + def value + " #{@value}" if @value + end + end + + class ChangeSet + def initialize + @set = {} + end + + def <<(change) + @set[change] = change + end + + def to_a + changes + end + + def changes + @set.values.map(&:to_s) + end + end + + class TargetedChangeSet < DelegateClass(ChangeSet) + def initialize(target) + @target = target + super(ChangeSet.new) + end + + def with(*args) + self << Change.new(@target, *args) + self + end + end +end -- cgit v1.2.3 From 0717f95455d882875107086544477fe9e8253fa1 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:32:42 -0400 Subject: Ruby 1.8.7 doesn't preserve hash insertion order --- spec/support/augeas.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/support/augeas.rb b/spec/support/augeas.rb index 4912e1a..7548684 100644 --- a/spec/support/augeas.rb +++ b/spec/support/augeas.rb @@ -19,9 +19,10 @@ module Augeas [target, name, Change].hash end - def eql?(other) + def ==(other) other.is_a?(self.class) && [other.target, other.name] == [target, name] end + alias_method :eql?, :== private @@ -37,11 +38,12 @@ module Augeas class ChangeSet def initialize - @set = {} + @set = [] end def <<(change) - @set[change] = change + index = @set.index(change) || @set.length + @set[index] = change end def to_a @@ -49,7 +51,7 @@ module Augeas end def changes - @set.values.map(&:to_s) + @set.map(&:to_s) end end -- cgit v1.2.3 From 07fdf27c8c4f0ae710b50bc00b2f5fb0ea0a400e Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:33:24 -0400 Subject: No need for these files to be exec able --- Gemfile | 0 manifests/server/share.pp | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 Gemfile mode change 100755 => 100644 manifests/server/share.pp diff --git a/Gemfile b/Gemfile old mode 100755 new mode 100644 diff --git a/manifests/server/share.pp b/manifests/server/share.pp old mode 100755 new mode 100644 -- cgit v1.2.3 From f815ee478ef89830d45dfcdd3b8f8f66f768a4a0 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:41:26 -0400 Subject: make contexts less wordy --- spec/defines/samba__server__share_spec.rb | 98 +++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index a621a15..2d779c3 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -77,7 +77,7 @@ describe 'samba::server::share', :type => :define do } ], }).each do |os, facts| - context "When on an #{os} system" do + context "for #{os}" do let(:facts) do facts.merge({ :concat_basedir => '/tmp', @@ -85,7 +85,7 @@ describe 'samba::server::share', :type => :define do }) end - context 'when called with base options' do + context 'with base options' do let(:title) { 'test_share' } let(:params) {{ :ensure => 'present' @@ -109,7 +109,7 @@ describe 'samba::server::share', :type => :define do } end#no params - context 'when called with ensure set to absent' do + context 'with ensure set to absent' do let(:title) { 'test_share' } let(:params) {{ :ensure => 'absent' @@ -125,7 +125,7 @@ describe 'samba::server::share', :type => :define do } end#no params - context 'when called with available set to true' do + context 'with available set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -134,7 +134,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("available", "yes") } end#available true - context 'when called with available set to false' do + context 'with available set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -143,7 +143,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("available", "no") } end#available false - context 'when called with browsable set to true' do + context 'with browsable set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -152,7 +152,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("browsable", "yes") } end#browsable false - context 'when called with browsable set to false' do + context 'with browsable set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -161,7 +161,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("browsable", "no") } end#browsable false - context 'when called with root_preexec set to /bin/true' do + context 'with root_preexec set to /bin/true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -170,7 +170,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("root preexec", "'/bin/true'") } end#root_preexec - context 'when called with comment set to "testing testing"' do + context 'with comment set to "testing testing"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -179,7 +179,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("comment", "'testing testing'") } end#comment - context 'when called with copy set to "testing testing"' do + context 'with copy set to "testing testing"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -188,7 +188,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("copy", "'testing testing'") } end#copy - context 'when called with create_mask set to "755"' do + context 'with create_mask set to "755"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -197,7 +197,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("create mask", "'755'") } end#create mask - context 'when called with directory_mask set to "755"' do + context 'with directory_mask set to "755"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -206,7 +206,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("directory mask", "'755'") } end#directory_mask - context 'when called with force_create_mask set to "755"' do + context 'with force_create_mask set to "755"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -215,7 +215,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("force create mask", "'755'") } end#force_create_mask - context 'when called with force_directory_mode set to "755"' do + context 'with force_directory_mode set to "755"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -224,7 +224,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("force directory mode", "'755'") } end#force_directory_mode - context 'when called with force_group set to "nogroup"' do + context 'with force_group set to "nogroup"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -233,7 +233,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("force group", "'nogroup'") } end#force_group - context 'when called with force_user set to "nobody"' do + context 'with force_user set to "nobody"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -242,7 +242,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("force user", "'nobody'") } end#force_user - context 'when called with guest_ok set to true' do + context 'with guest_ok set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -251,7 +251,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("guest ok", "yes") } end#guest_ok true - context 'when called with guest_ok set to false' do + context 'with guest_ok set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -260,7 +260,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("guest ok", "no") } end#guest_ok false - context 'when called with guest_only set to true' do + context 'with guest_only set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -269,7 +269,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("guest only", "yes") } end#guest_only false - context 'when called with guest_only set to false' do + context 'with guest_only set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -278,7 +278,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("guest only", "no") } end#guest_only false - context 'when called with hide_unreadable set to true' do + context 'with hide_unreadable set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -287,7 +287,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("hide unreadable", "yes") } end#hide_unreadable true - context 'when called with hide_unreadable set to false' do + context 'with hide_unreadable set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -296,7 +296,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("hide unreadable", "no") } end#hide_unreadable false - context 'when called with path set to /tmp' do + context 'with path set to /tmp' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -305,7 +305,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("path", "'/tmp'", nil) } end#path - context 'when called with read_only set to true' do + context 'with read_only set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -314,7 +314,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("read only", "yes") } end#read_only true - context 'when called with read_only set to false' do + context 'with read_only set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -323,7 +323,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("read only", "no") } end#read_only false - context 'when called with public set to true' do + context 'with public set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -332,7 +332,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("public", "yes") } end#public true - context 'when called with public set to false' do + context 'with public set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -341,7 +341,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("public", "no") } end#public false - context 'when called with writable set to true' do + context 'with writable set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -350,7 +350,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("writable", "yes") } end#writable true - context 'when called with writable set to false' do + context 'with writable set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -359,7 +359,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("writable", "no") } end#writable false - context 'when called with printable set to true' do + context 'with printable set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -368,7 +368,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("printable", "yes") } end#printable true - context 'when called with printable set to false' do + context 'with printable set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -377,7 +377,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("printable", "no") } end#printable false - context 'when called with follow_symlinks set to true' do + context 'with follow_symlinks set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -386,7 +386,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("follow symlinks", "yes") } end#follow_symlinks true - context 'when called with follow_symlinks set to false' do + context 'with follow_symlinks set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -395,7 +395,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("follow symlinks", "no") } end#follow_symlinks false - context 'when called with wide_links set to true' do + context 'with wide_links set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -404,7 +404,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("wide links", "yes") } end#wide_links true - context 'when called with wide_links set to false' do + context 'with wide_links set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -413,7 +413,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("wide links", "no") } end#wide_links false - context 'when called with map_acl_inherit set to true' do + context 'with map_acl_inherit set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -422,7 +422,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("map acl inherit", "yes") } end#map_acl_inherit true - context 'when called with map_acl_inherit set to false' do + context 'with map_acl_inherit set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -431,7 +431,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("map acl inherit", "no") } end#map_acl_inherit false - context 'when called with store_dos_attributes set to true' do + context 'with store_dos_attributes set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -440,7 +440,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("store dos attributes", "yes") } end#store_dos_attributes true - context 'when called with store_dos_attributes set to false' do + context 'with store_dos_attributes set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -449,7 +449,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("store dos attributes", "no") } end#store_dos_attributes false - context 'when called with strict_allocate set to true' do + context 'with strict_allocate set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -458,7 +458,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("strict allocate", "yes") } end#strict_allocate true - context 'when called with strict_allocate set to false' do + context 'with strict_allocate set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -467,7 +467,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("strict allocate", "no") } end#strict_allocate false - context 'when called with valid_users set to "bill,ben"' do + context 'with valid_users set to "bill,ben"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -476,7 +476,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("valid users", "'bill,ben'") } end#valid_users - context 'when called with op_locks set to "testing"' do + context 'with op_locks set to "testing"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -485,7 +485,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("oplocks", "'testing'") } end#op_locks - context 'when called with level2_oplocks set to "testing"' do + context 'with level2_oplocks set to "testing"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -494,7 +494,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("level2 oplocks", "'testing'") } end#level2_oplocks - context 'when called with veto_oplock_files set to "testing"' do + context 'with veto_oplock_files set to "testing"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -503,7 +503,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("veto oplock files", "'testing'") } end#veto_oplock_files - context 'when called with write_list set to "bill,ben"' do + context 'with write_list set to "bill,ben"' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -512,7 +512,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("write list", "'bill,ben'") } end#write_list - context 'when called with hide_dot_files set to true' do + context 'with hide_dot_files set to true' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -521,7 +521,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("hide dot files", "yes") } end#hide_dot_files true - context 'when called with hide_dot_files set to false' do + context 'with hide_dot_files set to false' do include_examples "default share" let(:params) {{ :ensure => 'present', @@ -530,7 +530,7 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("hide dot files", "no") } end#hide_dot_files false - context 'when called with root_preexec set to "/bin/test"' do + context 'with root_preexec set to "/bin/test"' do include_examples "default share" let(:params) {{ :ensure => 'present', -- cgit v1.2.3 From 952a3840805417b8efb2f438fe7b56116da0a9c6 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:45:09 -0400 Subject: remove block end comments; now they fit on screen --- spec/defines/samba__server__share_spec.rb | 96 +++++++++++++++---------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 2d779c3..50441f0 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -107,7 +107,7 @@ describe 'samba::server::share', :type => :define do :require => 'Augeas[test_share-section]', :notify => 'Class[Samba::Server::Service]') } - end#no params + end context 'with ensure set to absent' do let(:title) { 'test_share' } @@ -123,7 +123,7 @@ describe 'samba::server::share', :type => :define do :require => 'Class[Samba::Server::Config]', :notify => 'Class[Samba::Server::Service]') } - end#no params + end context 'with available set to true' do include_examples "default share" @@ -132,7 +132,7 @@ describe 'samba::server::share', :type => :define do :available => true, }} let(:change_set) { default_changes.with("available", "yes") } - end#available true + end context 'with available set to false' do include_examples "default share" @@ -141,7 +141,7 @@ describe 'samba::server::share', :type => :define do :available => false, }} let(:change_set) { default_changes.with("available", "no") } - end#available false + end context 'with browsable set to true' do include_examples "default share" @@ -150,7 +150,7 @@ describe 'samba::server::share', :type => :define do :browsable => true, }} let(:change_set) { default_changes.with("browsable", "yes") } - end#browsable false + end context 'with browsable set to false' do include_examples "default share" @@ -159,7 +159,7 @@ describe 'samba::server::share', :type => :define do :browsable => false, }} let(:change_set) { default_changes.with("browsable", "no") } - end#browsable false + end context 'with root_preexec set to /bin/true' do include_examples "default share" @@ -168,7 +168,7 @@ describe 'samba::server::share', :type => :define do :root_preexec => '/bin/true', }} let(:change_set) { default_changes.with("root preexec", "'/bin/true'") } - end#root_preexec + end context 'with comment set to "testing testing"' do include_examples "default share" @@ -177,7 +177,7 @@ describe 'samba::server::share', :type => :define do :comment => 'testing testing', }} let(:change_set) { default_changes.with("comment", "'testing testing'") } - end#comment + end context 'with copy set to "testing testing"' do include_examples "default share" @@ -186,7 +186,7 @@ describe 'samba::server::share', :type => :define do :copy => 'testing testing', }} let(:change_set) { default_changes.with("copy", "'testing testing'") } - end#copy + end context 'with create_mask set to "755"' do include_examples "default share" @@ -195,7 +195,7 @@ describe 'samba::server::share', :type => :define do :create_mask => '755', }} let(:change_set) { default_changes.with("create mask", "'755'") } - end#create mask + end context 'with directory_mask set to "755"' do include_examples "default share" @@ -204,7 +204,7 @@ describe 'samba::server::share', :type => :define do :directory_mask => '755', }} let(:change_set) { default_changes.with("directory mask", "'755'") } - end#directory_mask + end context 'with force_create_mask set to "755"' do include_examples "default share" @@ -213,7 +213,7 @@ describe 'samba::server::share', :type => :define do :force_create_mask => '755', }} let(:change_set) { default_changes.with("force create mask", "'755'") } - end#force_create_mask + end context 'with force_directory_mode set to "755"' do include_examples "default share" @@ -222,7 +222,7 @@ describe 'samba::server::share', :type => :define do :force_directory_mode => '755', }} let(:change_set) { default_changes.with("force directory mode", "'755'") } - end#force_directory_mode + end context 'with force_group set to "nogroup"' do include_examples "default share" @@ -231,7 +231,7 @@ describe 'samba::server::share', :type => :define do :force_group => 'nogroup', }} let(:change_set) { default_changes.with("force group", "'nogroup'") } - end#force_group + end context 'with force_user set to "nobody"' do include_examples "default share" @@ -240,7 +240,7 @@ describe 'samba::server::share', :type => :define do :force_user => 'nobody', }} let(:change_set) { default_changes.with("force user", "'nobody'") } - end#force_user + end context 'with guest_ok set to true' do include_examples "default share" @@ -249,7 +249,7 @@ describe 'samba::server::share', :type => :define do :guest_ok => true, }} let(:change_set) { default_changes.with("guest ok", "yes") } - end#guest_ok true + end context 'with guest_ok set to false' do include_examples "default share" @@ -258,7 +258,7 @@ describe 'samba::server::share', :type => :define do :guest_ok => false, }} let(:change_set) { default_changes.with("guest ok", "no") } - end#guest_ok false + end context 'with guest_only set to true' do include_examples "default share" @@ -267,7 +267,7 @@ describe 'samba::server::share', :type => :define do :guest_only => true, }} let(:change_set) { default_changes.with("guest only", "yes") } - end#guest_only false + end context 'with guest_only set to false' do include_examples "default share" @@ -276,7 +276,7 @@ describe 'samba::server::share', :type => :define do :guest_only => false, }} let(:change_set) { default_changes.with("guest only", "no") } - end#guest_only false + end context 'with hide_unreadable set to true' do include_examples "default share" @@ -285,7 +285,7 @@ describe 'samba::server::share', :type => :define do :hide_unreadable => true, }} let(:change_set) { default_changes.with("hide unreadable", "yes") } - end#hide_unreadable true + end context 'with hide_unreadable set to false' do include_examples "default share" @@ -294,7 +294,7 @@ describe 'samba::server::share', :type => :define do :hide_unreadable => false, }} let(:change_set) { default_changes.with("hide unreadable", "no") } - end#hide_unreadable false + end context 'with path set to /tmp' do include_examples "default share" @@ -303,7 +303,7 @@ describe 'samba::server::share', :type => :define do :path => '/tmp', }} let(:change_set) { default_changes.with("path", "'/tmp'", nil) } - end#path + end context 'with read_only set to true' do include_examples "default share" @@ -312,7 +312,7 @@ describe 'samba::server::share', :type => :define do :read_only => true, }} let(:change_set) { default_changes.with("read only", "yes") } - end#read_only true + end context 'with read_only set to false' do include_examples "default share" @@ -321,7 +321,7 @@ describe 'samba::server::share', :type => :define do :read_only => false, }} let(:change_set) { default_changes.with("read only", "no") } - end#read_only false + end context 'with public set to true' do include_examples "default share" @@ -330,7 +330,7 @@ describe 'samba::server::share', :type => :define do :public => true, }} let(:change_set) { default_changes.with("public", "yes") } - end#public true + end context 'with public set to false' do include_examples "default share" @@ -339,7 +339,7 @@ describe 'samba::server::share', :type => :define do :public => false, }} let(:change_set) { default_changes.with("public", "no") } - end#public false + end context 'with writable set to true' do include_examples "default share" @@ -348,7 +348,7 @@ describe 'samba::server::share', :type => :define do :writable => true, }} let(:change_set) { default_changes.with("writable", "yes") } - end#writable true + end context 'with writable set to false' do include_examples "default share" @@ -357,7 +357,7 @@ describe 'samba::server::share', :type => :define do :writable => false, }} let(:change_set) { default_changes.with("writable", "no") } - end#writable false + end context 'with printable set to true' do include_examples "default share" @@ -366,7 +366,7 @@ describe 'samba::server::share', :type => :define do :printable => true, }} let(:change_set) { default_changes.with("printable", "yes") } - end#printable true + end context 'with printable set to false' do include_examples "default share" @@ -375,7 +375,7 @@ describe 'samba::server::share', :type => :define do :printable => false, }} let(:change_set) { default_changes.with("printable", "no") } - end#printable false + end context 'with follow_symlinks set to true' do include_examples "default share" @@ -384,7 +384,7 @@ describe 'samba::server::share', :type => :define do :follow_symlinks => true, }} let(:change_set) { default_changes.with("follow symlinks", "yes") } - end#follow_symlinks true + end context 'with follow_symlinks set to false' do include_examples "default share" @@ -393,7 +393,7 @@ describe 'samba::server::share', :type => :define do :follow_symlinks => false, }} let(:change_set) { default_changes.with("follow symlinks", "no") } - end#follow_symlinks false + end context 'with wide_links set to true' do include_examples "default share" @@ -402,7 +402,7 @@ describe 'samba::server::share', :type => :define do :wide_links => true, }} let(:change_set) { default_changes.with("wide links", "yes") } - end#wide_links true + end context 'with wide_links set to false' do include_examples "default share" @@ -411,7 +411,7 @@ describe 'samba::server::share', :type => :define do :wide_links => false, }} let(:change_set) { default_changes.with("wide links", "no") } - end#wide_links false + end context 'with map_acl_inherit set to true' do include_examples "default share" @@ -420,7 +420,7 @@ describe 'samba::server::share', :type => :define do :map_acl_inherit => true, }} let(:change_set) { default_changes.with("map acl inherit", "yes") } - end#map_acl_inherit true + end context 'with map_acl_inherit set to false' do include_examples "default share" @@ -429,7 +429,7 @@ describe 'samba::server::share', :type => :define do :map_acl_inherit => false, }} let(:change_set) { default_changes.with("map acl inherit", "no") } - end#map_acl_inherit false + end context 'with store_dos_attributes set to true' do include_examples "default share" @@ -438,7 +438,7 @@ describe 'samba::server::share', :type => :define do :store_dos_attributes => true, }} let(:change_set) { default_changes.with("store dos attributes", "yes") } - end#store_dos_attributes true + end context 'with store_dos_attributes set to false' do include_examples "default share" @@ -447,7 +447,7 @@ describe 'samba::server::share', :type => :define do :store_dos_attributes => false, }} let(:change_set) { default_changes.with("store dos attributes", "no") } - end#store_dos_attributes false + end context 'with strict_allocate set to true' do include_examples "default share" @@ -456,7 +456,7 @@ describe 'samba::server::share', :type => :define do :strict_allocate => true, }} let(:change_set) { default_changes.with("strict allocate", "yes") } - end#strict_allocate true + end context 'with strict_allocate set to false' do include_examples "default share" @@ -465,7 +465,7 @@ describe 'samba::server::share', :type => :define do :strict_allocate => false, }} let(:change_set) { default_changes.with("strict allocate", "no") } - end#strict_allocate false + end context 'with valid_users set to "bill,ben"' do include_examples "default share" @@ -474,7 +474,7 @@ describe 'samba::server::share', :type => :define do :valid_users => 'bill,ben', }} let(:change_set) { default_changes.with("valid users", "'bill,ben'") } - end#valid_users + end context 'with op_locks set to "testing"' do include_examples "default share" @@ -483,7 +483,7 @@ describe 'samba::server::share', :type => :define do :op_locks => 'testing', }} let(:change_set) { default_changes.with("oplocks", "'testing'") } - end#op_locks + end context 'with level2_oplocks set to "testing"' do include_examples "default share" @@ -492,7 +492,7 @@ describe 'samba::server::share', :type => :define do :level2_oplocks => 'testing', }} let(:change_set) { default_changes.with("level2 oplocks", "'testing'") } - end#level2_oplocks + end context 'with veto_oplock_files set to "testing"' do include_examples "default share" @@ -501,7 +501,7 @@ describe 'samba::server::share', :type => :define do :veto_oplock_files => 'testing', }} let(:change_set) { default_changes.with("veto oplock files", "'testing'") } - end#veto_oplock_files + end context 'with write_list set to "bill,ben"' do include_examples "default share" @@ -510,7 +510,7 @@ describe 'samba::server::share', :type => :define do :write_list => 'bill,ben', }} let(:change_set) { default_changes.with("write list", "'bill,ben'") } - end#write_list + end context 'with hide_dot_files set to true' do include_examples "default share" @@ -519,7 +519,7 @@ describe 'samba::server::share', :type => :define do :hide_dot_files => true, }} let(:change_set) { default_changes.with("hide dot files", "yes") } - end#hide_dot_files true + end context 'with hide_dot_files set to false' do include_examples "default share" @@ -528,7 +528,7 @@ describe 'samba::server::share', :type => :define do :hide_dot_files => false, }} let(:change_set) { default_changes.with("hide dot files", "no") } - end#hide_dot_files false + end context 'with root_preexec set to "/bin/test"' do include_examples "default share" @@ -537,7 +537,7 @@ describe 'samba::server::share', :type => :define do :root_preexec => '/bin/test', }} let(:change_set) { default_changes.with("root preexec", "'/bin/test'") } - end#root_preexec + end end end end -- cgit v1.2.3 From ee15236a9dc9f7b082076679528a52f07bdf4664 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 8 Jul 2016 15:45:22 -0400 Subject: clean whitespace --- spec/classes/samba__server_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/samba__server_spec.rb b/spec/classes/samba__server_spec.rb index 46c5b15..cbd0a80 100644 --- a/spec/classes/samba__server_spec.rb +++ b/spec/classes/samba__server_spec.rb @@ -36,7 +36,7 @@ describe 'samba::server' do } } }} - it { + it { should contain_samba__server__share( 'testShare' ).with({ 'path' => '/path/to/some/share', 'browsable' => true, -- cgit v1.2.3 From f767ff0ae4bc7e135c2ba1e01ab76d51e9b13797 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 01:52:42 +1000 Subject: Add option to set profile acls on a share Add specs for profile acls option --- manifests/server/share.pp | 6 ++++++ spec/defines/samba__server__share_spec.rb | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index be4ee1e..9a5d030 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -27,6 +27,7 @@ define samba::server::share($ensure = present, $follow_symlinks = '', $wide_links = '', $map_acl_inherit = '', + $profile_acls = '', $store_dos_attributes = '', $strict_allocate = '', $hide_dot_files = '', @@ -149,6 +150,11 @@ define samba::server::share($ensure = present, false => "set \"${target}/map acl inherit\" no", default => "rm \"${target}/map acl inherit\"", }, + $profile_acls ? { + true => "set \"${target}/profile acls\" yes", + false => "set \"${target}/profile acls\" no", + default => "rm \"${target}/profile acls\"", + }, $store_dos_attributes ? { true => "set \"${target}/store dos attributes\" yes", false => "set \"${target}/store dos attributes\" no", diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 50441f0..62ccf92 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -26,6 +26,7 @@ shared_examples "default share" do set.with("follow symlinks") set.with("wide links") set.with("map acl inherit") + set.with("profile acls") set.with("store dos attributes") set.with("strict allocate") set.with("valid users") @@ -431,6 +432,24 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("map acl inherit", "no") } end + context 'with profile_acls set to true' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :profile_acls => true, + }} + let(:change_set) { default_changes.with("profile acls", "yes") } + end + + context 'with profile_acls set to false' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :profile_acls => false, + }} + let(:change_set) { default_changes.with("profile acls", "no") } + end + context 'with store_dos_attributes set to true' do include_examples "default share" let(:params) {{ -- cgit v1.2.3 From 8112ca0c42426b442984448ad2f3e9dae03089cd Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 01:49:00 +1000 Subject: Add option to add acl group control to a share --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 9a5d030..89bd8cc 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -26,6 +26,7 @@ define samba::server::share($ensure = present, $valid_users = '', $follow_symlinks = '', $wide_links = '', + $acl_group_control = '', $map_acl_inherit = '', $profile_acls = '', $store_dos_attributes = '', @@ -145,6 +146,11 @@ define samba::server::share($ensure = present, false => "set \"${target}/wide links\" no", default => "rm \"${target}/wide links\"", }, + $acl_group_control ? { + true => "set \"${target}/acl group control\" yes", + false => "set \"${target}/acl group control\" no", + default => "rm \"${target}/acl group control\"", + }, $map_acl_inherit ? { true => "set \"${target}/map acl inherit\" yes", false => "set \"${target}/map acl inherit\" no", -- cgit v1.2.3 From 511a6f7cb82d6da0d31c2f563d195003bc0c39dd Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:11:19 -0400 Subject: add specs for acl group control option, closes #69 --- spec/defines/samba__server__share_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 62ccf92..645b987 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -25,6 +25,7 @@ shared_examples "default share" do set.with("printable") set.with("follow symlinks") set.with("wide links") + set.with("acl group control") set.with("map acl inherit") set.with("profile acls") set.with("store dos attributes") @@ -414,6 +415,24 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("wide links", "no") } end + context 'with acl_group_control set to true' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :acl_group_control => true, + }} + let(:change_set) { default_changes.with("acl group control", "yes") } + end + + context 'with acl_group_control set to false' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :acl_group_control => false, + }} + let(:change_set) { default_changes.with("acl group control", "no") } + end + context 'with map_acl_inherit set to true' do include_examples "default share" let(:params) {{ -- cgit v1.2.3 From 4688b2bd2dc2393a1eacc583ce663634d01f70bb Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 00:57:44 +1000 Subject: Add option to set read list on a share --- manifests/server/share.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 89bd8cc..b68013b 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -20,6 +20,7 @@ define samba::server::share($ensure = present, $veto_oplock_files = '', $read_only = '', $public = '', + $read_list = '', $write_list = '', $writable = '', $printable = '', @@ -187,6 +188,10 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/veto oplock files\"", default => "set \"${target}/veto oplock files\" '${veto_oplock_files}'", }, + $read_list ? { + '' => "rm \"${target}/read list\"", + default => "set \"${target}/read list\" '${read_list}'", + }, $write_list ? { '' => "rm \"${target}/write list\"", default => "set \"${target}/write list\" '${write_list}'", -- cgit v1.2.3 From 113514e18a349e574be1205ee5008ee4e2c872c4 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:19:57 -0400 Subject: add specs for read list option, closes #68 --- manifests/server/share.pp | 2 +- spec/defines/samba__server__share_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b68013b..7cf0ffc 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -189,7 +189,7 @@ define samba::server::share($ensure = present, default => "set \"${target}/veto oplock files\" '${veto_oplock_files}'", }, $read_list ? { - '' => "rm \"${target}/read list\"", + '' => "rm \"${target}/read list\"", default => "set \"${target}/read list\" '${read_list}'", }, $write_list ? { diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 645b987..f6d1925 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -34,6 +34,7 @@ shared_examples "default share" do set.with("oplocks") set.with("level2 oplocks") set.with("veto oplock files") + set.with("read list") set.with("write list") set.with("hide dot files") set.with("root preexec") @@ -541,6 +542,15 @@ describe 'samba::server::share', :type => :define do let(:change_set) { default_changes.with("veto oplock files", "'testing'") } end + context 'with read_list set to "bill,ben"' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :read_list => 'bill,ben', + }} + let(:change_set) { default_changes.with("read list", "'bill,ben'") } + end + context 'with write_list set to "bill,ben"' do include_examples "default share" let(:params) {{ -- cgit v1.2.3 From 36b2f12d930cd8e552ec8a3d640c116b70b844e5 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 00:52:36 +1000 Subject: Add options to set iherit permissions on a share --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 7cf0ffc..58599d9 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -34,6 +34,7 @@ define samba::server::share($ensure = present, $strict_allocate = '', $hide_dot_files = '', $root_preexec = '', + $inherit_permissions = '', ) { $incl = $samba::server::incl @@ -205,6 +206,11 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/root preexec\"", default => "set \"${target}/root preexec\" '${root_preexec}'", }, + $inherit_permissions ? { + true => "set \"${target}/inherit permissions\" yes", + false => "set \"${target}/inherit permissions\" no", + default => "rm \"${target}/inherit permissions\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From 0831bc6db6914e8da7cdde08f05bba5ec9119179 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:30:46 -0400 Subject: specs for inherit permissions option, closes #67 --- spec/defines/samba__server__share_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index f6d1925..876d3f8 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -38,6 +38,7 @@ shared_examples "default share" do set.with("write list") set.with("hide dot files") set.with("root preexec") + set.with("inherit permissions") end let(:change_set) { default_changes } let(:changes) { change_set.to_a } @@ -586,6 +587,24 @@ describe 'samba::server::share', :type => :define do }} let(:change_set) { default_changes.with("root preexec", "'/bin/test'") } end + + context 'with inherit_permissions set to true' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :inherit_permissions => true, + }} + let(:change_set) { default_changes.with("inherit permissions", "yes") } + end + + context 'with inherit_permissions set to false' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :inherit_permissions => false, + }} + let(:change_set) { default_changes.with("inherit permissions", "no") } + end end end end -- cgit v1.2.3 From eaeb28eab8fd0d78f94bff1b9a05ea1755ef291e Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 00:44:59 +1000 Subject: Add option to set inherit acls on a share --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 58599d9..f039472 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -35,6 +35,7 @@ define samba::server::share($ensure = present, $hide_dot_files = '', $root_preexec = '', $inherit_permissions = '', + $inherit_acls = '', ) { $incl = $samba::server::incl @@ -211,6 +212,11 @@ define samba::server::share($ensure = present, false => "set \"${target}/inherit permissions\" no", default => "rm \"${target}/inherit permissions\"", }, + $inherit_acls ? { + true => "set \"${target}/inherit acls\" yes", + false => "set \"${target}/inherit acls\" no", + default => "rm \"${target}/inherit acls\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From babc3f5f1e924d071cb7ec137c5898ab1df4bf62 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:34:46 -0400 Subject: specs for inherit acls, closes #66 --- spec/defines/samba__server__share_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 876d3f8..b4182f0 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -39,6 +39,7 @@ shared_examples "default share" do set.with("hide dot files") set.with("root preexec") set.with("inherit permissions") + set.with("inherit acls") end let(:change_set) { default_changes } let(:changes) { change_set.to_a } @@ -605,6 +606,24 @@ describe 'samba::server::share', :type => :define do }} let(:change_set) { default_changes.with("inherit permissions", "no") } end + + context 'with inherit_acls set to true' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :inherit_acls => true, + }} + let(:change_set) { default_changes.with("inherit acls", "yes") } + end + + context 'with inherit_acls set to false' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :inherit_acls => false, + }} + let(:change_set) { default_changes.with("inherit acls", "no") } + end end end end -- cgit v1.2.3 From 858b93ce5c8080e98bd653cc452d2d7426019828 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 00:23:05 +1000 Subject: Add option to set delete readonly on a share --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index f039472..4bd146d 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -36,6 +36,7 @@ define samba::server::share($ensure = present, $root_preexec = '', $inherit_permissions = '', $inherit_acls = '', + $delete_readonly = '', ) { $incl = $samba::server::incl @@ -217,6 +218,11 @@ define samba::server::share($ensure = present, false => "set \"${target}/inherit acls\" no", default => "rm \"${target}/inherit acls\"", }, + $delete_readonly ? { + true => "set \"${target}/delete read only\" yes", + false => "set \"${target}/delete read only\" no", + default => "rm \"${target}/delete read only\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From f594999ebe16943d7e3f074fdf3aa70744de1384 Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 00:37:12 +1000 Subject: Fix option name for delete readonly --- manifests/server/share.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 4bd146d..45dd5a0 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -219,9 +219,9 @@ define samba::server::share($ensure = present, default => "rm \"${target}/inherit acls\"", }, $delete_readonly ? { - true => "set \"${target}/delete read only\" yes", - false => "set \"${target}/delete read only\" no", - default => "rm \"${target}/delete read only\"", + true => "set \"${target}/delete readonly\" yes", + false => "set \"${target}/delete readonly\" no", + default => "rm \"${target}/delete readonly\"", }, ] -- cgit v1.2.3 From 245503153be7ef32b90b4074707b86a68f99667f Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:46:15 -0400 Subject: specs for delete readonly option, closes #65 --- spec/defines/samba__server__share_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index b4182f0..f4665c0 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -40,6 +40,7 @@ shared_examples "default share" do set.with("root preexec") set.with("inherit permissions") set.with("inherit acls") + set.with("delete readonly") end let(:change_set) { default_changes } let(:changes) { change_set.to_a } @@ -624,6 +625,24 @@ describe 'samba::server::share', :type => :define do }} let(:change_set) { default_changes.with("inherit acls", "no") } end + + context 'with delete_readonly set to true' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :delete_readonly => true, + }} + let(:change_set) { default_changes.with("delete readonly", "yes") } + end + + context 'with delete_readonly set to false' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :delete_readonly => false, + }} + let(:change_set) { default_changes.with("delete readonly", "no") } + end end end end -- cgit v1.2.3 From 4475fb5496eeeea6cae610f029513369d58f385e Mon Sep 17 00:00:00 2001 From: Pete Brown Date: Wed, 29 Jun 2016 00:09:36 +1000 Subject: Add option for setting printer name on a share --- manifests/server/share.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 45dd5a0..bbdc0a6 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -37,6 +37,7 @@ define samba::server::share($ensure = present, $inherit_permissions = '', $inherit_acls = '', $delete_readonly = '', + $printer_name = '', ) { $incl = $samba::server::incl @@ -223,6 +224,10 @@ define samba::server::share($ensure = present, false => "set \"${target}/delete readonly\" no", default => "rm \"${target}/delete readonly\"", }, + $printer_name ? { + default => "set \"${target}/printer name\" '${printer_name}'", + '' => "rm \"${target}/printer name\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From fcf3f6af854d20e701a74c3e9d4d5f7af20e8c71 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:51:46 -0400 Subject: specs for printer name option, closes #64 --- spec/defines/samba__server__share_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index f4665c0..2033ee8 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -41,6 +41,7 @@ shared_examples "default share" do set.with("inherit permissions") set.with("inherit acls") set.with("delete readonly") + set.with("printer name") end let(:change_set) { default_changes } let(:changes) { change_set.to_a } @@ -643,6 +644,15 @@ describe 'samba::server::share', :type => :define do }} let(:change_set) { default_changes.with("delete readonly", "no") } end + + context 'with printer_name set to "killing trees"' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :printer_name => 'killing trees', + }} + let(:change_set) { default_changes.with("printer name", "'killing trees'") } + end end end end -- cgit v1.2.3 From 4a6e4fb559d2c9c7bbda33c0afb6af5a2172e745 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 14:53:14 -0400 Subject: keep default in a consistent order in conditionals --- manifests/server/share.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index bbdc0a6..bb70753 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -225,8 +225,8 @@ define samba::server::share($ensure = present, default => "rm \"${target}/delete readonly\"", }, $printer_name ? { - default => "set \"${target}/printer name\" '${printer_name}'", '' => "rm \"${target}/printer name\"", + default => "set \"${target}/printer name\" '${printer_name}'", }, ] -- cgit v1.2.3 From e5bea510003dd77683ac991e808b6983281dde44 Mon Sep 17 00:00:00 2001 From: John Hodrien Date: Wed, 9 Mar 2016 16:45:24 +0000 Subject: Add msdfs_root paramter to share --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index bb70753..86cbb13 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -38,6 +38,7 @@ define samba::server::share($ensure = present, $inherit_acls = '', $delete_readonly = '', $printer_name = '', + $msdfs_root = '', ) { $incl = $samba::server::incl @@ -228,6 +229,11 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/printer name\"", default => "set \"${target}/printer name\" '${printer_name}'", }, + $msdfs_root ? { + true => "set \"${target}/msdfs root\" yes", + false => "set \"${target}/msdfs root\" no", + default => "rm \"${target}/msdfs root\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From 4c2e759147b6a5fd0ce62709944189ada538e64e Mon Sep 17 00:00:00 2001 From: John Hodrien Date: Tue, 15 Mar 2016 10:25:38 +0000 Subject: Add spec test for msdfs root --- spec/acceptance/basic_samba_spec.rb | 1 + spec/classes/samba__server_spec.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/spec/acceptance/basic_samba_spec.rb b/spec/acceptance/basic_samba_spec.rb index 8a9e363..e50cb2a 100644 --- a/spec/acceptance/basic_samba_spec.rb +++ b/spec/acceptance/basic_samba_spec.rb @@ -22,6 +22,7 @@ describe 'basic samba' do force_group => 'group', force_user => 'user', hide_dot_files => false, + msdfs_root => true, } "} diff --git a/spec/classes/samba__server_spec.rb b/spec/classes/samba__server_spec.rb index cbd0a80..37d5aa8 100644 --- a/spec/classes/samba__server_spec.rb +++ b/spec/classes/samba__server_spec.rb @@ -30,6 +30,7 @@ describe 'samba::server' do 'writable' => true, 'guest_ok' => true, 'guest_only' => true, + 'msdfs_root' => true, }, 'testShare2' => { 'path' => '/some/other/path' @@ -43,6 +44,7 @@ describe 'samba::server' do 'writable' => true, 'guest_ok' => true, 'guest_only' => true, + 'msdfs_root' => true, }) } it { should contain_samba__server__share( 'testShare2' ).with_path('/some/other/path') } -- cgit v1.2.3 From 460c503edc6a11dcc44a2fad3c75e5ef96124e9b Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 15:02:20 -0400 Subject: specs for msdfs root, closes #56 --- spec/defines/samba__server__share_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 2033ee8..ec36f24 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -42,6 +42,7 @@ shared_examples "default share" do set.with("inherit acls") set.with("delete readonly") set.with("printer name") + set.with("msdfs root") end let(:change_set) { default_changes } let(:changes) { change_set.to_a } @@ -653,6 +654,24 @@ describe 'samba::server::share', :type => :define do }} let(:change_set) { default_changes.with("printer name", "'killing trees'") } end + + context 'with msdfs_root set to true' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :msdfs_root => true, + }} + let(:change_set) { default_changes.with("msdfs root", "yes") } + end + + context 'with msdfs_root set to false' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :msdfs_root => false, + }} + let(:change_set) { default_changes.with("msdfs root", "no") } + end end end end -- cgit v1.2.3 From e4a25276936fecb5465a7abdab34bee1c88e7df8 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 15:04:53 -0400 Subject: align params --- spec/defines/samba__server__share_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index ec36f24..7e1c8a0 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -424,7 +424,7 @@ describe 'samba::server::share', :type => :define do context 'with acl_group_control set to true' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :acl_group_control => true, }} let(:change_set) { default_changes.with("acl group control", "yes") } @@ -433,7 +433,7 @@ describe 'samba::server::share', :type => :define do context 'with acl_group_control set to false' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :acl_group_control => false, }} let(:change_set) { default_changes.with("acl group control", "no") } @@ -550,7 +550,7 @@ describe 'samba::server::share', :type => :define do context 'with read_list set to "bill,ben"' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :read_list => 'bill,ben', }} let(:change_set) { default_changes.with("read list", "'bill,ben'") } @@ -595,7 +595,7 @@ describe 'samba::server::share', :type => :define do context 'with inherit_permissions set to true' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :inherit_permissions => true, }} let(:change_set) { default_changes.with("inherit permissions", "yes") } @@ -604,7 +604,7 @@ describe 'samba::server::share', :type => :define do context 'with inherit_permissions set to false' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :inherit_permissions => false, }} let(:change_set) { default_changes.with("inherit permissions", "no") } @@ -613,7 +613,7 @@ describe 'samba::server::share', :type => :define do context 'with inherit_acls set to true' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :inherit_acls => true, }} let(:change_set) { default_changes.with("inherit acls", "yes") } @@ -622,7 +622,7 @@ describe 'samba::server::share', :type => :define do context 'with inherit_acls set to false' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :inherit_acls => false, }} let(:change_set) { default_changes.with("inherit acls", "no") } @@ -631,7 +631,7 @@ describe 'samba::server::share', :type => :define do context 'with delete_readonly set to true' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :delete_readonly => true, }} let(:change_set) { default_changes.with("delete readonly", "yes") } @@ -640,7 +640,7 @@ describe 'samba::server::share', :type => :define do context 'with delete_readonly set to false' do include_examples "default share" let(:params) {{ - :ensure => 'present', + :ensure => 'present', :delete_readonly => false, }} let(:change_set) { default_changes.with("delete readonly", "no") } -- cgit v1.2.3 From 293bcc94cba842737a89e37339d46ad5bb8cd6ab Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sun, 10 Jul 2016 21:02:50 -0400 Subject: re-implement guest account on the share level --- manifests/server/share.pp | 5 +++++ spec/defines/samba__server__share_spec.rb | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 86cbb13..5544caf 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -39,6 +39,7 @@ define samba::server::share($ensure = present, $delete_readonly = '', $printer_name = '', $msdfs_root = '', + $guest_account = '', ) { $incl = $samba::server::incl @@ -234,6 +235,10 @@ define samba::server::share($ensure = present, false => "set \"${target}/msdfs root\" no", default => "rm \"${target}/msdfs root\"", }, + $guest_account ? { + '' => "rm \"${target}/guest account\"", + default => "set \"${target}/guest account\" '${guest_account}'", + }, ] augeas { "${name}-changes": diff --git a/spec/defines/samba__server__share_spec.rb b/spec/defines/samba__server__share_spec.rb index 7e1c8a0..894f334 100644 --- a/spec/defines/samba__server__share_spec.rb +++ b/spec/defines/samba__server__share_spec.rb @@ -43,6 +43,7 @@ shared_examples "default share" do set.with("delete readonly") set.with("printer name") set.with("msdfs root") + set.with("guest account") end let(:change_set) { default_changes } let(:changes) { change_set.to_a } @@ -672,6 +673,15 @@ describe 'samba::server::share', :type => :define do }} let(:change_set) { default_changes.with("msdfs root", "no") } end + + context 'with guest_account set to "killing trees"' do + include_examples "default share" + let(:params) {{ + :ensure => 'present', + :guest_account => 'someone', + }} + let(:change_set) { default_changes.with("guest account", "'someone'") } + end end end end -- cgit v1.2.3 From ac64bc86a0a486d577b7930232db5623bd2e5850 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 11 Jul 2016 08:51:21 -0400 Subject: bump minor version --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 173933f..c56ab74 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "ajjahn-samba", - "version": "0.4.1", + "version": "0.5.0", "author": "Adam Jahn", "summary": "Module for provisioning Samba", "license": "Apache-2.0", -- cgit v1.2.3 From 0cc76f3930cea9dd7200ff6e1c6917d68f3ee5ea Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 11 Jul 2016 09:12:48 -0400 Subject: Fix indentation --- manifests/server/ads.pp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index d7d462c..7e2ffe0 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -39,7 +39,7 @@ class samba::server::ads($ensure = present, $winbind_package = 'winbind' } - package{ + package { $krb5_user_package: ensure => installed; $winbind_package: ensure => installed; 'expect': ensure => installed; @@ -50,18 +50,24 @@ class samba::server::ads($ensure = present, # notify winbind samba::server::option { - 'realm': value => $realm, - notify => Class['Samba::Server::Winbind']; - 'winbind uid': value => $winbind_uid, - notify => Class['Samba::Server::Winbind']; - 'winbind gid': value => $winbind_gid, - notify => Class['Samba::Server::Winbind']; - 'winbind enum groups': value => $winbind_enum_groups, - notify => Class['Samba::Server::Winbind']; - 'winbind enum users': value => $winbind_enum_users, - notify => Class['Samba::Server::Winbind']; - 'winbind use default domain': value => $winbind_use_default_domain, - notify => Class['Samba::Server::Winbind']; + 'realm': + value => $realm, + notify => Class['Samba::Server::Winbind']; + 'winbind uid': + value => $winbind_uid, + notify => Class['Samba::Server::Winbind']; + 'winbind gid': + value => $winbind_gid, + notify => Class['Samba::Server::Winbind']; + 'winbind enum groups': + value => $winbind_enum_groups, + notify => Class['Samba::Server::Winbind']; + 'winbind enum users': + value => $winbind_enum_users, + notify => Class['Samba::Server::Winbind']; + 'winbind use default domain': + value => $winbind_use_default_domain, + notify => Class['Samba::Server::Winbind']; } samba::server::option { -- cgit v1.2.3 From 52aab7d30e14fb74695a1914857c902128bfb384 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Wed, 13 Jul 2016 19:39:29 -0400 Subject: [blacksmith] Bump version to 0.5.1 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index c56ab74..5e3d84b 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "ajjahn-samba", - "version": "0.5.0", + "version": "0.5.1", "author": "Adam Jahn", "summary": "Module for provisioning Samba", "license": "Apache-2.0", -- cgit v1.2.3 From 1020f7ca2be81c64f4a56816731390a852b62e89 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Wed, 13 Jul 2016 19:42:50 -0400 Subject: ignore vagrant box directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ff6674..49f2ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ pkg/ log/ Gemfile.lock spec/fixtures/ +.vagrant/ -- cgit v1.2.3