Use first NIC with IP address by default
Previously fuelmenu took first network interface (if it's not specified by user) as default option for admin NIC whether it has IP address or not. Now it tries to find a NIC with IP assigned, so it works fine without additional options when admin network is attached to not first interface. Change-Id: Iabd0ebb81af40b4f97f67df92403fcff7c268edf Related-bug: #1566557
This commit is contained in:
parent
53c5a00f86
commit
7edf1ec946
@ -427,12 +427,18 @@ def main(*args, **kwargs):
|
||||
if urwid.VERSION < (1, 1, 0):
|
||||
print("This program requires urwid 1.1.0 or greater.")
|
||||
|
||||
try:
|
||||
default_iface = network.get_physical_ifaces()[0]
|
||||
except IndexError:
|
||||
network_interfaces = network.get_physical_ifaces()
|
||||
if not network_interfaces:
|
||||
print("Unable to detect any network interfaces. Could not start")
|
||||
sys.exit(1)
|
||||
|
||||
default_iface = network_interfaces[0]
|
||||
|
||||
for nic in network_interfaces:
|
||||
if network.is_interface_has_ip(nic):
|
||||
default_iface = nic
|
||||
break
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-s", "--save-only", dest="save_only",
|
||||
action="store_true",
|
||||
|
Loading…
Reference in New Issue
Block a user