diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | isys/isys.py | 12 | ||||
-rw-r--r-- | textw/network_text.py | 4 |
3 files changed, 20 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2006-03-02 Chris Lumens <clumens@redhat.com> + + * isys/isys.py (compareNetDevices): Add a function to more + intelligently sort network device names (#166842). + * textw/network_text.py: Use compareNetDevices. + 2006-03-02 Paul Nasrat <pnasrat@redhat.com> * yuminstall.py: Conditionals in yum now diff --git a/isys/isys.py b/isys/isys.py index c4e139751..d45b545bc 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -522,6 +522,18 @@ def compareDrives(first, second): return 0 +def compareNetDevices(first, second): + trimmed_first = int(first.lstrip(string.letters)) + trimmed_second = int(second.lstrip(string.letters)) + + if trimmed_first < trimmed_second: + return -1 + elif trimmed_first > trimmed_second: + return 1 + else: + return 0 + + def configNetDevice(device, ip, netmask, gw): return _isys.confignetdevice(device, ip, netmask, gw) diff --git a/textw/network_text.py b/textw/network_text.py index 5b9e4686e..c1202a901 100644 --- a/textw/network_text.py +++ b/textw/network_text.py @@ -55,7 +55,7 @@ class NetworkDeviceWindow: onboot = dev.get("onboot") devnames = self.devices.keys() - devnames.sort() + devnames.sort(cmp=isys.compareNetDevices) if devnames.index(dev.get("DEVICE")) == 0 and not onboot: onbootIsOn = 1 else: @@ -204,7 +204,7 @@ class NetworkDeviceWindow: return INSTALL_NOOP list = self.devices.keys() - list.sort() + list.sort(cmp=isys.compareNetDevices) devLen = len(list) if dir == 1: currentDev = 0 |