1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
# 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 -%>
|