On Tue, Feb 05, 2013 at 05:05:38PM -0600, David Lehman wrote:
+ _vars = rc.split()
+ info = {}
+ for var in _vars:
+ (name, equals, value) = var.partition("=")
+ if not equals:
+ continue
- # don't raise an exception if pv is not a part of any vg
- pv_name = vals[0]
- try:
- vg_name, vg_uuid = vals[2], vals[3]
- except IndexError:
- vg_name, vg_uuid = "", ""
-
- info = {'pv_name': pv_name,
- 'vg_name': vg_name,
- 'vg_uuid': vg_uuid}
+ if "," in value:
+ val = value.strip().split(",")
+ else:
+ val = value.strip()
+
+ info[name] = val
Looks like this could be turned into a utility method, since something
very similar is also used below.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)