# File managed by Puppet
<%-
  def bool2str(v)
    case v
    when true
      'yes'
    when false
      'no'
    else
      v
    end
  end
-%>

<%- @options.each do |k, v| -%>
<%- if v.is_a?(Hash) -%>
<%- if k.length > 1024 -%>
<%- fail("Line exceeds 1024 characters: #{k}") -%>
<%- end -%>
<%= k %>
<%- v.sort.each do |key, value| -%>
    <%- if value.is_a?(Array) -%>
    <%- value.each do |a| -%>
    <%- if a != '' && a != nil -%>
    <%- line_content = "#{key} #{bool2str(a)}" -%>
    <%- if line_content.length > 1020 -%>
    <%- fail("Line exceeds 1024 characters: #{line_content}") -%>
    <%- else -%>
    <%= line_content %>
    <%- end -%>
    <%- end -%>
    <%- end -%>
    <%- elsif value != '' && value != nil -%>
    <%- line_content = "#{key} #{bool2str(value)}" -%>
    <%- if line_content.length > 1020 -%>
    <%- fail("Line exceeds 1024 characters: #{line_content}") -%>
    <%- end -%>
    <%= line_content %>
    <%- end -%>
<%- end -%>
<%- else -%>
<%- if v.is_a?(Array) -%>
<%- v.each do |a| -%>
<%- if a != '' && a != nil -%>
<%- line_content = "#{k} #{bool2str(a)}" -%>
<%- if line_content.length > 1024 -%>
<%- fail("Line exceeds 1024 characters: #{line_content}") -%>
<%- end -%>
<%= k %> <%= bool2str(a) %>
<%- end -%>
<%- end -%>
<%- elsif v != :undef && v != '' && v != nil -%>
<%- line_content = "#{k} #{bool2str(v)}" -%>
<%- if line_content.length > 1024 -%>
<%- fail("Line exceeds 1024 characters: #{line_content}") -%>
<%- end -%>
<%= k %> <%= bool2str(v) %>
<%- end -%>
<%- end -%>
<%- end -%>
