Commit 86719ce7 by James Tanner

Fixes #5040 setup module: do not add primary interface info to the secondary interface data

parent cb2214d6
...@@ -1540,8 +1540,7 @@ class LinuxNetwork(Network): ...@@ -1540,8 +1540,7 @@ class LinuxNetwork(Network):
iface = words[-1] iface = words[-1]
if iface != device: if iface != device:
interfaces[iface] = {} interfaces[iface] = {}
interfaces[iface].update(interfaces[device]) if not secondary and "ipv4_secondaries" not in interfaces[iface]:
if "ipv4_secondaries" not in interfaces[iface]:
interfaces[iface]["ipv4_secondaries"] = [] interfaces[iface]["ipv4_secondaries"] = []
if not secondary or "ipv4" not in interfaces[iface]: if not secondary or "ipv4" not in interfaces[iface]:
interfaces[iface]['ipv4'] = {'address': address, interfaces[iface]['ipv4'] = {'address': address,
...@@ -1553,6 +1552,15 @@ class LinuxNetwork(Network): ...@@ -1553,6 +1552,15 @@ class LinuxNetwork(Network):
'netmask': netmask, 'netmask': netmask,
'network': network, 'network': network,
}) })
# add this secondary IP to the main device
if secondary:
interfaces[device]["ipv4_secondaries"].append({
'address': address,
'netmask': netmask,
'network': network,
})
# If this is the default address, update default_ipv4 # If this is the default address, update default_ipv4
if 'address' in default_ipv4 and default_ipv4['address'] == address: if 'address' in default_ipv4 and default_ipv4['address'] == address:
default_ipv4['netmask'] = netmask default_ipv4['netmask'] = netmask
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment