if not "DEVICE" in kvp :
exit(1)
+autolist = []
output=[]
basename=kvp["DEVICE"]
# 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 ...
output += [""]
# Mark this new interface for automatic up.
-output = ["auto "+" ".join(autolist)] + output
+if len(autolist):
+ output = ["auto "+" ".join(autolist)] + output
print("===================================")
print(output)