]> gitweb.fluxo.info Git - puppet-shorewall.git/commitdiff
Internal refactoring of shorewall::interface
authorintrigeri <intrigeri@boum.org>
Thu, 16 Dec 2010 15:09:24 +0000 (16:09 +0100)
committerintrigeri <intrigeri@boum.org>
Thu, 16 Dec 2010 15:10:50 +0000 (16:10 +0100)
... for more consistent options management.
The public API does not change.

manifests/interface.pp

index 0b61950801463a975be7134c6d0a4fb8b6a346ff..2bb0896c474672822920843bc931b070a8d31e49 100644 (file)
@@ -7,28 +7,23 @@ define shorewall::interface(
     $dhcp = false,
     $order = 100
 ){
-    if $add_options == '' {
-      $added_options = ''
-    } else {
-      $added_options = ",${add_options}"
+    $added_opts = $add_options ? {
+        ''      => '',
+        default => ",${add_options}",
     }
 
-    if $rfc1918 {
-        if $dhcp {
-            $options_real = "${options},dhcp"
-        } else {
-            $options_real = "$options"
-        }
-    } else {
-        if $dhcp {
-            $options_real = "${options},norfc1918,dhcp"
-        } else {
-            $options_real = "${options},norfc1918"
-        }
+    $dhcp_opt = $dhcp ? {
+        false   => '',
+        default => ',dhcp',
+    }
+
+    $rfc1918_opt = $rfc1918 ? {
+        false   => ',norfc1918',
+        default => '',
     }
 
     shorewall::entry { "interfaces.d/${order}-${title}":
-        line => "${zone} ${name} ${broadcast} ${options_real}${added_options}",
+        line => "${zone} ${name} ${broadcast} ${options}${dhcp_opt}${rfc1918_opt}${added_opts}",
     }
 }