seems we do not do anything useful with the value apart from displaying it. Related: rhbz#626842 --- pyanaconda/iutil.py | 13 +++++++++++++ pyanaconda/storage/udev.py | 14 +------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py index 9a1c142..b07f9ed 100644 --- a/pyanaconda/iutil.py +++ b/pyanaconda/iutil.py @@ -1074,6 +1074,19 @@ def parseNfsUrl(nfsurl): host = s[0] return (options, host, path) +def insert_colons(a_string): + """ + Insert colon between every second character. + + E.g. creates 'al:go:ri:th:ms' from 'algoritms'. Useful for formatting MAC + addresses and wwids for output. + """ + suffix = a_string[-2:] + if len(a_string) > 2: + return insert_colons(a_string[:-2]) + ':' + suffix + else: + return suffix + def add_po_path(module, dir): """ Looks to see what translations are under a given path and tells the gettext module to use that path as the base dir """ diff --git a/pyanaconda/storage/udev.py b/pyanaconda/storage/udev.py index a4154c2..223c33a 100644 --- a/pyanaconda/storage/udev.py +++ b/pyanaconda/storage/udev.py @@ -263,19 +263,7 @@ 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] - - return "" + return iutil.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