Re: [PATCH] Be more careful when selecting a vg name.

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

 



On Mon, Mar 09, 2009 at 02:29:58PM -0400, Chris Lumens wrote:
> > diff --git a/storage/devicelibs/lvm.py b/storage/devicelibs/lvm.py
> > index bdb732a..e5b0bd9 100644
> > --- a/storage/devicelibs/lvm.py
> > +++ b/storage/devicelibs/lvm.py
> > @@ -236,6 +236,20 @@ def vginfo(vg_name):
> >       d['pe_count'],d['pe_free'],d['pv_count']) = info
> >      return d
> >  
> > +def vgdetectednames():
> > +    """ Will run vgs and return all the detected names.
> > +
> > +    There is a change that there are vgnames that are recognized by lvm.
> > +    It is important to know what these vgs are.
> > +    """
> > +    retval = []
> > +    names = iutil.execWithCapture("lvm",
> > +            ["vgs", "--noheadings", "-o", "vg_name"],
> > +            stderr="/dev/tty5")
> > +    for name in names.strip("\n").split("\n"):
> > +        retval.append(name.strip())
> > +    return retval
> > +
> 
> I like, but how are you going to split on a newline if you've already
> stripped it off?

I strip the new lines at the beginning and end of the string to then
split with the newlines that are left inside the sting.

1. raw string:
\nasdf\nwqer\nsag\nwer\n\n
2. stripted stirng
asdf\nwqer\nsag\nwer
3. split string
["asdf", "nwqer", "sag", "wer"]

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

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.

_______________________________________________
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