[yakkety/master-next 1/2] UBUNTU: hv_set_ifconfig -- handle DHCP interfaces correctly

Andy Whitcroft apw at canonical.com
Wed Nov 9 10:23:36 UTC 2016


BugLink: http://bugs.launchpad.net/bugs/1640109
Signed-off-by: Andy Whitcroft <apw at canonical.com>
---
 debian/cloud-tools/hv_set_ifconfig | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/cloud-tools/hv_set_ifconfig b/debian/cloud-tools/hv_set_ifconfig
index 4b4f49f..1ed7158 100755
--- a/debian/cloud-tools/hv_set_ifconfig
+++ b/debian/cloud-tools/hv_set_ifconfig
@@ -83,6 +83,7 @@ if not "HWADDR" in kvp :
 if not "DEVICE" in kvp :
     exit(1)
 
+autolist = []
 output=[]
 basename=kvp["DEVICE"]
 
@@ -98,11 +99,10 @@ dns_emitted = False
 # IPV4 may either be dhcp or static.
 if ("DHCP" in kvp and kvp["DHCP"] == "yes") or \
    ("BOOTPROTO" in kvp and kvp["BOOTPROTO"] == "dhcp"):
-    output += ["auto " + basename]
+    autolist.append(basename)
     output += ["iface " + basename  + " inet dhcp"]
     output += [""]
 else:
-    autolist = []
     # Matchup the interface specific lines
 
     # No real max for the number of interface + aliases ...
@@ -168,7 +168,8 @@ for if6_count in v6names:
         output += [""]
 
 # Mark this new interface for automatic up.
-output = ["auto "+" ".join(autolist)] + output
+if len(autolist):
+    output = ["auto "+" ".join(autolist)] + output
 
 print("===================================")
 print(output)
-- 
2.9.3





More information about the kernel-team mailing list