Merge "Use first NIC with IP address by default"

This commit is contained in:
Jenkins 2016-05-23 12:32:16 +00:00 committed by Gerrit Code Review
commit 8cd87313fe
1 changed files with 9 additions and 3 deletions

View File

@ -336,12 +336,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",