aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/server.pp7
-rw-r--r--spec/classes/samba__server_spec.rb43
2 files changed, 49 insertions, 1 deletions
diff --git a/manifests/server.pp b/manifests/server.pp
index 8d6a214..cbc61a9 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -19,7 +19,9 @@ class samba::server($interfaces = '',
$pam_password_change = '',
$os_level = '',
$preferred_master = '',
- $bind_interfaces_only = 'yes',) {
+ $bind_interfaces_only = 'yes',
+ $shares = {},
+ $users = {}, ) {
include samba::server::install
include samba::server::config
@@ -60,4 +62,7 @@ class samba::server($interfaces = '',
'os level': value => $os_level;
'preferred master': value => $preferred_master;
}
+
+ create_resources(samba::server::share, $shares)
+ create_resources(samba::server::user, $users)
}
diff --git a/spec/classes/samba__server_spec.rb b/spec/classes/samba__server_spec.rb
index dbf840a..46c5b15 100644
--- a/spec/classes/samba__server_spec.rb
+++ b/spec/classes/samba__server_spec.rb
@@ -20,4 +20,47 @@ describe 'samba::server' do
it { should contain_samba__server__option('printing') }
it { should contain_samba__server__option('printcap name') }
it { should contain_samba__server__option('disable spoolss') }
+
+ context 'with hiera shares hash' do
+ let(:params) {{
+ 'shares' => {
+ 'testShare' => {
+ 'path' => '/path/to/some/share',
+ 'browsable' => true,
+ 'writable' => true,
+ 'guest_ok' => true,
+ 'guest_only' => true,
+ },
+ 'testShare2' => {
+ 'path' => '/some/other/path'
+ }
+ }
+ }}
+ it {
+ should contain_samba__server__share( 'testShare' ).with({
+ 'path' => '/path/to/some/share',
+ 'browsable' => true,
+ 'writable' => true,
+ 'guest_ok' => true,
+ 'guest_only' => true,
+ })
+ }
+ it { should contain_samba__server__share( 'testShare2' ).with_path('/some/other/path') }
+ end
+
+ context 'with hiera users hash' do
+ let(:params) {{
+ 'users' => {
+ 'testUser' => {
+ 'password' => 'testpass01'
+ },
+ 'testUser2' => {
+ 'password' => 'testpass02'
+ }
+ }
+ }}
+ it { should contain_samba__server__user( 'testUser' ).with_password('testpass01') }
+ it { should contain_samba__server__user( 'testUser2' ).with_password('testpass02') }
+ end
+
end