Re: [PATCH 02/14] Make sure sizes contains only floats in udev_device_get_lv_sizes()

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

 



On Sun, 2009-03-01 at 20:32 -1000, David Cantrell wrote:
> info['LVM2_LV_SIZE'] may contain some entries that are shell
> variable syntax, so strip the variable name and equal sign
> when building the sizes list.

This was handled by my code, just not correctly. Please give this patch
a try and see if it serves your purposes:

diff --git a/storage/udev.py b/storage/udev.py
index 4f83c2a..d849a0e 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -104,7 +104,7 @@ def udev_parse_block_entry(buf):
         elif tag == "S":
             dev['symlinks'].append(val)
         elif tag == "E":
-            if val.count("=") > 1 and val.count(" ") == 1:
+            if val.count("=") > 1 and val.count(" ") > 1:
                 # eg: LVM2_LV_NAME when querying the VG for its LVs
                 vars = val.split()
                 vals = []

Dave

> ---
>  storage/udev.py |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/storage/udev.py b/storage/udev.py
> index 4f83c2a..d0cf6fb 100644
> --- a/storage/udev.py
> +++ b/storage/udev.py
> @@ -262,12 +262,17 @@ def udev_device_get_lv_uuids(info):
>  def udev_device_get_lv_sizes(info):
>      # lvm's decmial precision is not configurable, so we tell it to use
>      # KB and convert to MB here
> +    def _splitVar(var):
> +        lst = var.split('=')
> +        return lst[len(lst) - 1]
> +
>      sizes = info['LVM2_LV_SIZE']
>      if not sizes:
>          sizes = []
>      elif not isinstance(sizes, list):
>          sizes = [sizes]
>  
> +    sizes = map(lambda s: _splitVar(s), sizes)
>      return [float(s) / 1024 for s in sizes]
>  
> 

_______________________________________________
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