Skip to content

Commit

Permalink
Don't add a host restriction for empty arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Arakmar committed Mar 14, 2017
1 parent 805cff5 commit 8ee9475
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions templates/ferm-rule.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@
domain (<%= @domain %>) {
table <%= @table %> {
chain <%= @chain %> {
<% if @host %>saddr (<% if (@host.is_a? String) %><%= @host %><% elsif (@host.is_a? Array) -%><% @host.each do |ns| %><%= ns %> <% end -%><% end -%>) {<% end -%>
<% if (defined? @rules) %><% if (@rules.is_a? String) %>
<% if @host and not (@host.is_a? Array and @host.empty?) -%>
saddr (<% if (@host.is_a? String) -%><%= @host -%><% elsif (@host.is_a? Array) -%><%= @host.join(' ') -%><% end -%>) {
<% end -%>
<% if (defined? @rules) -%>
<% if (@rules.is_a? String) -%>
<%= @rules %>;
<% elsif (@rules.is_a? Array) -%>
<% @rules.each do |ns| %> <%= ns %>;
<% @rules.each do |ns| -%>
<%= ns %>;
<% end -%>
<% end -%>
<% end -%>
<% if @host %>}<% end -%>

<% if @host and not (@host.is_a? Array and @host.empty?) -%>
}
<% end -%>
}
}
}
}

0 comments on commit 8ee9475

Please sign in to comment.