]> gitweb.fluxo.info Git - puppet-samba.git/commitdiff
workgroup should be optional and generic
authorAdam Jahn <ajjahn@gmail.com>
Fri, 24 Aug 2012 16:27:26 +0000 (12:27 -0400)
committerAdam Jahn <ajjahn@gmail.com>
Fri, 24 Aug 2012 16:27:26 +0000 (12:27 -0400)
manifests/server.pp

index ce6f10c9ce39164b1ba865e451dfc14ab0222a18..6addab86354822aacd5dd77d7728bc09a3f15d18 100644 (file)
@@ -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'],
+  }
+
 }