Re: [master] filtering UI: don't be picky about udev wwid length.

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/26/2010 07:34 AM, Ales Kozumplik wrote:
> 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. """

Ack!

- -- 
Brian C. Lane <bcl@xxxxxxxxxx>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Remember Lexington Green!

iQEVAwUBTHaG3BF+jBaO/jp/AQLa3AgAlzzp8kFSmpRdoWGNq3IB3UrU9ihtSXxW
q7NFY0qnmOOfzigGhAhUARLNQpstAR3PLs+aP8U97mmLkNr/LU2hW31XTVKsgKn0
DuAilvHlN0XO2aMRXKZwy4rJn37yeZTDhUJMFnD6msRg7a79JHjiL1IxEVpjwqzM
LHeAVYAHtBkasxWckdFYfK/2zn7ww31H60zMGldJlDRR/vYdmBrkH8Yp+nVbCUOt
+r7XxE/rqE/uoq5mky7azbysiJ2bI3VRwx6hKcseps7PtWvn28sKNr54uxAxjk5B
3qDkj2Z0tR/5wWBfM7nq//ntut16fPYl+QF0Z66m0S2K+/09Hz+cRA==
=SpFX
-----END PGP SIGNATURE-----

_______________________________________________
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