From 3691f9c09adbb9dbde9bb945b0f4da0e5a525ced Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 16 Dec 2010 16:09:24 +0100 Subject: Internal refactoring of shorewall::interface ... for more consistent options management. The public API does not change. --- manifests/interface.pp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/manifests/interface.pp b/manifests/interface.pp index 0b61950..2bb0896 100644 --- a/manifests/interface.pp +++ b/manifests/interface.pp @@ -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}", } } -- cgit v1.2.3