From 5f40365c453128f2ee7f0a22f11eb3434fedd64a Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Sun, 14 Oct 2018 14:41:34 +0200
Subject: [PATCH] [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>
---
sos/plugins/block.py | 10 +++++-----
1 file 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):
--
2.17.2