mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #6279 from techtonik/patch-1
setup: Fix KeyError: 'ipv4_secondaries' (issue #6274)
This commit is contained in:
commit
da2126eda5
1 changed files with 4 additions and 2 deletions
|
@ -1564,13 +1564,13 @@ class LinuxNetwork(Network):
|
|||
iface = words[-1]
|
||||
if iface != device:
|
||||
interfaces[iface] = {}
|
||||
if not secondary and "ipv4_secondaries" not in interfaces[iface]:
|
||||
interfaces[iface]["ipv4_secondaries"] = []
|
||||
if not secondary or "ipv4" not in interfaces[iface]:
|
||||
interfaces[iface]['ipv4'] = {'address': address,
|
||||
'netmask': netmask,
|
||||
'network': network}
|
||||
else:
|
||||
if "ipv4_secondaries" not in interfaces[iface]:
|
||||
interfaces[iface]["ipv4_secondaries"] = []
|
||||
interfaces[iface]["ipv4_secondaries"].append({
|
||||
'address': address,
|
||||
'netmask': netmask,
|
||||
|
@ -1579,6 +1579,8 @@ class LinuxNetwork(Network):
|
|||
|
||||
# add this secondary IP to the main device
|
||||
if secondary:
|
||||
if "ipv4_secondaries" not in interfaces[device]:
|
||||
interfaces[device]["ipv4_secondaries"] = []
|
||||
interfaces[device]["ipv4_secondaries"].append({
|
||||
'address': address,
|
||||
'netmask': netmask,
|
||||
|
|
Loading…
Reference in a new issue