From a48f0da9d877f174fac651a70eee718d82cef0f8 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Tue, 4 Mar 2014 20:00:18 +0200 Subject: [PATCH] setup: Fix KeyError: 'ipv4_secondaries' (issue #6274) --- library/system/setup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/system/setup b/library/system/setup index 4328195b75..f140991dc2 100644 --- a/library/system/setup +++ b/library/system/setup @@ -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,