diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2018-10-14 14:41:34 +0200 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-01-14 11:33:03 +0000 |
commit | 5f40365c453128f2ee7f0a22f11eb3434fedd64a (patch) | |
tree | 83a86e793c58c979ffcf8c1150e1e0bbef0e5b55 | |
parent | 516d97bbfcd58d665dffff0e02a15b15249dd530 (diff) | |
download | sos-5f40365c453128f2ee7f0a22f11eb3434fedd64a.tar.gz |
[block] proper parsing of luks partition on self device
Simplify identification of LUKS partitions by collecting lsblk with
option -l, such that the device name is the very first string every
time. That is required for LUKS partition located on the device itself
where standard lsblk output does not contain '|-' before the device name.
Resolves: #1449
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/plugins/block.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sos/plugins/block.py b/sos/plugins/block.py index 059686c5..e7e25bba 100644 --- a/sos/plugins/block.py +++ b/sos/plugins/block.py @@ -27,11 +27,11 @@ class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): return out for line in lsblk_out.splitlines(): # find in output lines like - # |-sda2 crypto_LUKS <uuid> - # and separate device name - it will be 1st string on the line - # after first '-' + # sda2 crypto_LUKS <uuid> + # loop0 crypto_LUKS <uuid> + # and separate device name - it will be the 1st string on the line if 'crypto_LUKS' in line: - dev = line.split()[0].split('-', 1)[1] + dev = line.split()[0] out.append(dev) return out @@ -67,7 +67,7 @@ class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): "fdisk -l %s" % disk_path ]) - lsblk_file = self.get_cmd_output_now("lsblk -f -a") + lsblk_file = self.get_cmd_output_now("lsblk -f -a -l") # for LUKS devices, collect cryptsetup luksDump if lsblk_file: for dev in self.get_luks_devices(lsblk_file): |