From d8c319fb569977afcd54f72ddfe3c6aa2b61a9f1 Mon Sep 17 00:00:00 2001 From: Jirgn Mssnr Date: Tue, 9 Feb 2016 17:51:12 +0100 Subject: added share config via hiera --- manifests/server.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'manifests/server.pp') diff --git a/manifests/server.pp b/manifests/server.pp index 8d6a214..59d5d51 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -19,7 +19,8 @@ class samba::server($interfaces = '', $pam_password_change = '', $os_level = '', $preferred_master = '', - $bind_interfaces_only = 'yes',) { + $bind_interfaces_only = 'yes', + $shares = {},) { include samba::server::install include samba::server::config @@ -60,4 +61,6 @@ class samba::server($interfaces = '', 'os level': value => $os_level; 'preferred master': value => $preferred_master; } + + create_resources(samba::server::share, $shares) } -- cgit v1.2.3 From 0385193ee30c830e81be53b1d7484ae27cdd2b85 Mon Sep 17 00:00:00 2001 From: Jirgn Mssnr Date: Mon, 22 Feb 2016 13:47:19 +0100 Subject: added param users for use in hiera added tests for samba::server::users --- manifests/server.pp | 4 +++- spec/classes/samba__server_spec.rb | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'manifests/server.pp') diff --git a/manifests/server.pp b/manifests/server.pp index 59d5d51..cbc61a9 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -20,7 +20,8 @@ class samba::server($interfaces = '', $os_level = '', $preferred_master = '', $bind_interfaces_only = 'yes', - $shares = {},) { + $shares = {}, + $users = {}, ) { include samba::server::install include samba::server::config @@ -63,4 +64,5 @@ class samba::server($interfaces = '', } 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 d19fe6a..46c5b15 100644 --- a/spec/classes/samba__server_spec.rb +++ b/spec/classes/samba__server_spec.rb @@ -36,8 +36,31 @@ describe 'samba::server' do } } }} - it { should contain_samba__server__share( 'testShare' ) } - it { should contain_samba__server__share( 'testShare2' ) } + 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 -- cgit v1.2.3