# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

<% if auto.any? %>
auto <%= auto.join(" ") %>
<% end %>

<% mappings.each do |name, options| %>
mapping <%= name %>
  script <%= options["script"] %>
  <% options["maps"].each do |value| -%>
  map <%= value %>
  <% end -%>
<% end %>

<% interfaces.each do |name, options| %>
iface <%= name %> inet <%= options["method"] %>
  <% options.reject { |k, v| k == "method" }.each do |key, value| -%>
  <%= key %> <%= value %>
  <% end -%>
<% end %>

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

<% if auto.any? %>
auto <%= auto.join(" ") %>
<% end %>

<% mappings.sort.each do |name_and_options| %>
mapping <%= name_and_options[0] %>
  script <%= name_and_options[1]["script"] %>
  <% name_and_options[1]["maps"].each do |value| -%>
  map <%= value %>
  <% end -%>
<% end %>

<% interfaces.each do |name_and_options| %>
iface <%= name_and_options[0] %> inet <%= name_and_options[1]["method"] %>
  <% name_and_options[1].reject { |k, v| k == "method" }.sort.each do |option| -%>
  <%= option[0] %> <%= option[1] %>
  <% end -%>
<% end %>

Work around lack of sorted hashes in Ruby 1.8.
Work around lack of sorted hashes in Ruby 1.8.
