From 7c10f82e1bf5e0d79283efdcffe154f3411486ee Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 24 Aug 2012 12:27:26 -0400 Subject: workgroup should be optional and generic --- manifests/server.pp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index ce6f10c..6addab8 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,16 +1,24 @@ -class samba::server($workgroup = PCCH) { +class samba::server($workgroup = '') { include samba::server::install include samba::server::config include samba::server::service + $context = "/files/etc/samba/smb.conf" $target = "target[. = 'global']" - augeas { global: - context => "/files/etc/samba/smb.conf", - changes => [ - "set ${target} global", - "set ${target}/workgroup $workgroup" - ], + augeas { 'global-section': + context => $context, + changes => "set ${target} global", require => Class["samba::server::config"] } + + augeas { 'global-workgroup': + context => $context, + changes => $workgroup ? { + default => "set ${target}/workgroup $workgroup", + '' => "rm ${target}/workgroup", + }, + require => Augeas['global-section'], + } + } -- cgit v1.2.3