[rhel6-branch] filtering UI: don't be picky about udev wwid length.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



seems we do not do anything useful with the value apart from
displaying it.

Related: rhbz#626842
---
 storage/udev.py |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/storage/udev.py b/storage/udev.py
index cf1534e..dd540ab 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -268,20 +268,15 @@ def udev_device_get_serial(udev_info):
 def udev_device_get_wwid(udev_info):
     """ The WWID of a device is typically just its serial number, but with
         colons in the name to make it more readable. """
-    serial = udev_device_get_serial(udev_info)
-    if not serial:
-        return ""
-
-    serial_len = len(serial)
-
-    if serial_len == 32 or serial_len == 16:
-        retval = ""
-        for i in range(0, (serial_len / 2)):
-            retval += serial[i*2:i*2+2] + ":"
-
-        return retval[0:-1]
+    def insert_colons(a_string):
+        suffix = a_string[-2:]
+        if len(a_string) > 2:
+            return insert_colons(a_string[:-2]) + ':' + suffix
+        else:
+            return suffix
 
-    return ""
+    serial = udev_device_get_serial(udev_info)
+    return insert_colons(serial) if serial else ""
 
 def udev_device_get_vendor(udev_info):
     """ Get the vendor of the device as reported by udev. """
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux