Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix interface template for SUSE

BOOTPROTO was always set to "static" and no IP addresses were written to the
ifcfg files.

This should make the network cookbook at least working again for "normal"
phyiscal interfaces. Might need addtional work for bridge, vlan and bonding
configs.
  • Loading branch information...
commit 730bfe248a8f8d95aeaf0c5e4e468a6ef9ac0798 1 parent 70e36bd
@rhafer rhafer authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 chef/cookbooks/network/templates/default/suse-cfg.erb
View
12 chef/cookbooks/network/templates/default/suse-cfg.erb
@@ -13,9 +13,13 @@ def quote(s)
end
iface=@interfaces[@nic.name]
-%>
-NAME='<%=quote(@nic.name)%>'
+NAME=<%=quote(@nic.name)%>
STARTMODE=auto
+<% if iface["slave"] -%>
BOOTPROTO=none
+<% else -%>
+BOOTPROTO=static
+<% end -%>
<% case
when @nic.kind_of?(Nic::Bridge) -%>
BRIDGE=yes
@@ -30,7 +34,7 @@ BONDING_MODULE_OPTS=<%=quote("mode=#{@nic.mode} miimon=#{@nic.miimon}")%>
BONDING_SLAVE_<%=i%>=<%=quote(slave)%>
<% end -%>
<% end -%>
-<% if addr=iface["address"].detect{|i|i.kind_of?(IP::IP4)} -%>
-IPADDR=<%=addr.addr%>
-NETMASK=<%=addr.netmask%>
+<% v4addrs, v6addrs = iface["addresses"].map{|a|::IP.coerce(a)}.partition{|a|a.kind_of? IP::IP4}
+ v4addrs.each_index do |i| -%>
+IPADDR<%=(i == 0)?'':(i+1).to_s%>=<%=v4addrs[i].to_s%>
<% end -%>
Please sign in to comment.
Something went wrong with that request. Please try again.