Message ID | 20161109102337.6005-2-apw@canonical.com |
---|---|
State | New |
Headers | show |
On 09/11/16 10:23, Andy Whitcroft wrote: > BugLink: http://bugs.launchpad.net/bugs/1640109 > Signed-off-by: Andy Whitcroft <apw@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) > Seems reasonable to me. Acked-by: Colin Ian King <colin.king@canonical.com>
Looks reasonable.
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)
BugLink: http://bugs.launchpad.net/bugs/1640109 Signed-off-by: Andy Whitcroft <apw@canonical.com> --- debian/cloud-tools/hv_set_ifconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)