In the first patch I fixed the regular expression but neglected to adjust the index of the path match group accordingly. In this version I just drop the groups that we don't care about to simplify maintenance in case this command's output changes again in the future.
--- pyanaconda/storage/devicelibs/btrfs.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/storage/devicelibs/btrfs.py b/pyanaconda/storage/devicelibs/btrfs.py index 14c0f55..bfc5e0a 100644 --- a/pyanaconda/storage/devicelibs/btrfs.py +++ b/pyanaconda/storage/devicelibs/btrfs.py @@ -108,7 +108,7 @@ def list_subvolumes(mountpoint): args = ["subvol", "list", mountpoint] buf = btrfs(args, capture=True) vols = [] - for group in re.findall(r'ID (\d+) gen (\d+) top level (\d+) path (.+)\n', buf): - vols.append({"id": int(group[0]), "path": group[2]}) + for group in re.findall(r'ID (\d+) gen \d+ top level \d+ path (.+)\n', buf): + vols.append({"id": int(group[0]), "path": group[1]})
return vols
On 11/06/2012 03:20 PM, David Lehman wrote:
pyanaconda/storage/devicelibs/btrfs.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/storage/devicelibs/btrfs.py b/pyanaconda/storage/devicelibs/btrfs.py index 14c0f55..bfc5e0a 100644 --- a/pyanaconda/storage/devicelibs/btrfs.py +++ b/pyanaconda/storage/devicelibs/btrfs.py @@ -108,7 +108,7 @@ def list_subvolumes(mountpoint): args = ["subvol", "list", mountpoint] buf = btrfs(args, capture=True) vols = []
- for group in re.findall(r'ID (\d+) gen (\d+) top level (\d+) path (.+)\n', buf):
vols.append({"id": int(group[0]), "path": group[2]})
for group in re.findall(r'ID (\d+) gen \d+ top level \d+ path (.+)\n', buf):
vols.append({"id": int(group[0]), "path": group[1]}) return vols
ACK
anaconda-patches@lists.fedorahosted.org