Re: [PATCH 1/5] Add function udev_device_get_lv_attr to retrieve lv attribute strings.

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

 



On Mon, 2009-09-21 at 14:07 -0400, Chris Lumens wrote:
> > --- a/storage/udev.py
> > +++ b/storage/udev.py
> > @@ -261,6 +261,14 @@ def udev_device_get_lv_sizes(info):
> >  
> >      return [float(s) / 1024 for s in sizes]
> >  
> > +def udev_device_get_lv_attr(info):
> > +    attr = info['LVM2_LV_ATTR']
> > +    if not attr:
> > +        attr = []
> > +    elif not isinstance(attr, list):
> > +        attr = [attr]
> > +    return attr
> > +
> >  def udev_device_is_biosraid(info):
> >      # Note that this function does *not* identify raid sets.
> >      # Tests to see if device is parto of a dmraid set.
> 
> You could probably still get a KeyError when you look up LVM2_LV_ATTR,
> right?  So, how about:
> 
>    attr = info.get("LVM2_LV_ATTR", [])
> 
> to replace the first three lines?  I know you use this idiom in plenty
> of other places.

We catch KeyError when we call the function from storage/devicetree.py.
It's the same as most of the other udev_device_get_foo functions. We do
that so that it's clear to the caller that something is wrong/missing.

Dave

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

_______________________________________________
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