]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: hv_set_ifconfig -- handle DHCP interfaces correctly
authorAndy Whitcroft <apw@canonical.com>
Wed, 9 Nov 2016 10:23:36 +0000 (10:23 +0000)
committerAndy Whitcroft <apw@canonical.com>
Mon, 13 Mar 2017 18:33:39 +0000 (18:33 +0000)
BugLink: http://bugs.launchpad.net/bugs/1640109
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
debian/cloud-tools/hv_set_ifconfig

index 4b4f49f92b228f875c7532a10036457e443c5e0a..1ed715868e27184ba300bdb1409b8e036b834198 100755 (executable)
@@ -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)