summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2006-03-02 21:02:30 +0000
committerChris Lumens <clumens@redhat.com>2006-03-02 21:02:30 +0000
commit6d81a30fe1a63f96a92c45c1dd9a25c1168bf282 (patch)
treeefb4446252b5d2f8c2941a6b6318d01ca8267d06
parent4550faf0ca5060f9a7e639adf499b77d8201ba89 (diff)
downloadanaconda-6d81a30fe1a63f96a92c45c1dd9a25c1168bf282.tar.gz
anaconda-6d81a30fe1a63f96a92c45c1dd9a25c1168bf282.tar.xz
anaconda-6d81a30fe1a63f96a92c45c1dd9a25c1168bf282.zip
Add a function to more intelligently sort network device names (#166842).
-rw-r--r--ChangeLog6
-rw-r--r--isys/isys.py12
-rw-r--r--textw/network_text.py4
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ccf9cf24d..28344a774 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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