aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jahn <ajjahn@gmail.com>2016-02-22 11:44:42 -0500
committerAdam Jahn <ajjahn@gmail.com>2016-02-22 11:44:42 -0500
commit4c1f7bcca1293ebd0377a0e5d5df310a6f6d4b13 (patch)
tree96548890cc647005b93bd4b674bf994609350834
parent3cc71eaac5e120a2b4e5be339b6eb4e3d78349c1 (diff)
parent0385193ee30c830e81be53b1d7484ae27cdd2b85 (diff)
downloadpuppet-samba-4c1f7bcca1293ebd0377a0e5d5df310a6f6d4b13.tar.gz
puppet-samba-4c1f7bcca1293ebd0377a0e5d5df310a6f6d4b13.tar.bz2
Merge pull request #54 from jirgn/feature_shares_and_users_via_hiera
Feature shares and users via hiera
-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