Skip to content
Snippets Groups Projects
Commit e663a9bf authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Unify IP and DNS templating in example unattend

parent b6e477ac
Branches
Tags
No related merge requests found
...@@ -104,11 +104,10 @@ end ...@@ -104,11 +104,10 @@ end
<Interface wcm:action="add"> <Interface wcm:action="add">
<Identifier><%= iface.identifier.empty? ? 'Ethernet' : iface.identifier %></Identifier> <Identifier><%= iface.identifier.empty? ? 'Ethernet' : iface.identifier %></Identifier>
<UnicastIpAddresses> <UnicastIpAddresses>
<%- if !iface.ip.empty? && iface.subnet -%> <%- { iface.ip => iface.subnet, iface.ip6 => iface.subnet6 }
<IpAddress wcm:action="add" wcm:keyValue="1"><%= iface.ip %>/<%= iface.subnet.cidr %></IpAddress> .reject { |k, v| k.empty? || v.nil? }
<%- end -%> .each.with_index do |(ip, subnet), i| -%>
<%- if !iface.ip6.empty? && iface.subnet6 -%> <IpAddress wcm:action="add" wcm:keyValue="<%= i + 1 %>"><%= ip %>/<%= subnet.cidr %></IpAddress>
<IpAddress wcm:action="add" wcm:keyValue="2"><%= iface.ip6 %>/<%= iface.subnet6.cidr %></IpAddress>
<%- end -%> <%- end -%>
</UnicastIpAddresses> </UnicastIpAddresses>
<Routes> <Routes>
...@@ -140,7 +139,7 @@ end ...@@ -140,7 +139,7 @@ end
<Interface wcm:action="add"> <Interface wcm:action="add">
<DNSServerSearchOrder> <DNSServerSearchOrder>
<%- [iface.subnet.dns_primary, iface.subnet.dns_secondary].reject(&:empty?).each.with_index do |dns_ip, i| -%> <%- [iface.subnet.dns_primary, iface.subnet.dns_secondary].reject(&:empty?).each.with_index do |dns_ip, i| -%>
<IpAddress wcm:action="add" wcm:keyValue="<%= i %>"><%= dns_ip %></IpAddress> <IpAddress wcm:action="add" wcm:keyValue="<%= i + 1 %>"><%= dns_ip %></IpAddress>
<%- end -%> <%- end -%>
</DNSServerSearchOrder> </DNSServerSearchOrder>
<Identifier><%= iface.identifier.empty? ? 'Ethernet' : iface.identifier %></Identifier> <Identifier><%= iface.identifier.empty? ? 'Ethernet' : iface.identifier %></Identifier>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment