]> gitweb.fluxo.info Git - puppet-samba.git/commitdiff
extract os params to params class
authorAdam Jahn <ajjahn@gmail.com>
Mon, 13 Apr 2015 19:14:36 +0000 (15:14 -0400)
committerAdam Jahn <ajjahn@gmail.com>
Mon, 13 Apr 2015 19:14:36 +0000 (15:14 -0400)
manifests/server/params.pp [new file with mode: 0644]
manifests/server/service.pp

diff --git a/manifests/server/params.pp b/manifests/server/params.pp
new file mode 100644 (file)
index 0000000..aa9674e
--- /dev/null
@@ -0,0 +1,30 @@
+# == Class samba::server::params
+#
+class samba::server::params {
+  case $::osfamily {
+    'Redhat': { $service_name = 'smb' }
+
+    #On Debian family: Debian 7 => samba , Ubuntu => smbd
+    #Others, I don't know, hope 'samba' will works
+    'Debian': {
+      case $::operatingsystem{
+        'Debian': { $service_name = 'samba' }
+        'Ubuntu': { $service_name = 'smbd' }
+        default: { $service_name = 'samba' }
+      }
+    }
+    'Gentoo': { $service_name = 'samba' }
+    'Archlinux': { $service_name = 'smbd' }
+
+    # Currently Gentoo has $::osfamily = "Linux". This should change in
+    # Factor 1.7.0 <http://projects.puppetlabs.com/issues/17029>, so
+    # adding workaround.
+    'Linux': {
+      case $::operatingsystem {
+        'Gentoo':  { $service_name = 'samba' }
+        default: { fail("${::operatingsystem} is not supported by this module.") }
+      }
+    }
+    default: { fail("${::osfamily} is not supported by this module.") }
+  }
+}
index 22264971880fb74a641eb38f46004cfb9c7680b5..a8797deeb57800e968b5a75d5a244027cab713fd 100644 (file)
@@ -1,32 +1,9 @@
-class samba::server::service ($ensure = running, $enable = true) {
-  case $::osfamily {
-      'Redhat': { $service_name = 'smb' }
-
-      #On Debian family: Debian 7 => samba , Ubuntu => smbd
-      #Others, I don't know, hope 'samba' will works
-      'Debian': {
-        case $::operatingsystem{
-                'Debian': { $service_name = 'samba' }
-                'Ubuntu': { $service_name = 'smbd' }
-                default: { $service_name = 'samba' }
-        }
-      }
-      'Gentoo': { $service_name = 'samba' }
-      'Archlinux': { $service_name = 'smbd' }
-
-      # Currently Gentoo has $::osfamily = "Linux". This should change in
-      # Factor 1.7.0 <http://projects.puppetlabs.com/issues/17029>, so
-      # adding workaround.
-      'Linux': {
-        case $::operatingsystem {
-          'Gentoo':  { $service_name = 'samba' }
-          default: { fail("${::operatingsystem} is not supported by this module.") }
-        }
-      }
-      default: { fail("${::osfamily} is not supported by this module.") }
-    }
 # == Class samba::server::server
 #
+class samba::server::service (
+  $ensure = running,
+  $enable = true
+) inherits samba::server::params {
 
   service { $service_name :
     ensure      => $ensure,
@@ -35,5 +12,4 @@ class samba::server::service ($ensure = running, $enable = true) {
     enable      => $enable,
     require     => Class['samba::server::config']
   }
-
 }