summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-12-16 16:09:24 +0100
committerintrigeri <intrigeri@boum.org>2010-12-16 16:10:50 +0100
commit3691f9c09adbb9dbde9bb945b0f4da0e5a525ced (patch)
tree9bc6980319a1e50add9845d54f8344484e8f50d6
parentffbf93324ce5c912e843775ef973d2e09ea272b3 (diff)
Internal refactoring of shorewall::interface
... for more consistent options management. The public API does not change.
-rw-r--r--manifests/interface.pp29
1 files 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}",
}
}