|
|
fce3c4 |
From 5f40365c453128f2ee7f0a22f11eb3434fedd64a Mon Sep 17 00:00:00 2001
|
|
|
fce3c4 |
From: Pavel Moravec <pmoravec@redhat.com>
|
|
|
fce3c4 |
Date: Sun, 14 Oct 2018 14:41:34 +0200
|
|
|
fce3c4 |
Subject: [PATCH] [block] proper parsing of luks partition on self device
|
|
|
fce3c4 |
|
|
|
fce3c4 |
Simplify identification of LUKS partitions by collecting lsblk with
|
|
|
fce3c4 |
option -l, such that the device name is the very first string every
|
|
|
fce3c4 |
time. That is required for LUKS partition located on the device itself
|
|
|
fce3c4 |
where standard lsblk output does not contain '|-' before the device name.
|
|
|
fce3c4 |
|
|
|
fce3c4 |
Resolves: #1449
|
|
|
fce3c4 |
|
|
|
fce3c4 |
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
|
|
|
fce3c4 |
---
|
|
|
fce3c4 |
sos/plugins/block.py | 10 +++++-----
|
|
|
fce3c4 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
fce3c4 |
|
|
|
fce3c4 |
diff --git a/sos/plugins/block.py b/sos/plugins/block.py
|
|
|
fce3c4 |
index 059686c5..e7e25bba 100644
|
|
|
fce3c4 |
--- a/sos/plugins/block.py
|
|
|
fce3c4 |
+++ b/sos/plugins/block.py
|
|
|
fce3c4 |
@@ -27,11 +27,11 @@ class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
|
fce3c4 |
return out
|
|
|
fce3c4 |
for line in lsblk_out.splitlines():
|
|
|
fce3c4 |
# find in output lines like
|
|
|
fce3c4 |
- # |-sda2 crypto_LUKS <uuid>
|
|
|
fce3c4 |
- # and separate device name - it will be 1st string on the line
|
|
|
fce3c4 |
- # after first '-'
|
|
|
fce3c4 |
+ # sda2 crypto_LUKS <uuid>
|
|
|
fce3c4 |
+ # loop0 crypto_LUKS <uuid>
|
|
|
fce3c4 |
+ # and separate device name - it will be the 1st string on the line
|
|
|
fce3c4 |
if 'crypto_LUKS' in line:
|
|
|
fce3c4 |
- dev = line.split()[0].split('-', 1)[1]
|
|
|
fce3c4 |
+ dev = line.split()[0]
|
|
|
fce3c4 |
out.append(dev)
|
|
|
fce3c4 |
return out
|
|
|
fce3c4 |
|
|
|
fce3c4 |
@@ -67,7 +67,7 @@ class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
|
fce3c4 |
"fdisk -l %s" % disk_path
|
|
|
fce3c4 |
])
|
|
|
fce3c4 |
|
|
|
fce3c4 |
- lsblk_file = self.get_cmd_output_now("lsblk -f -a")
|
|
|
fce3c4 |
+ lsblk_file = self.get_cmd_output_now("lsblk -f -a -l")
|
|
|
fce3c4 |
# for LUKS devices, collect cryptsetup luksDump
|
|
|
fce3c4 |
if lsblk_file:
|
|
|
fce3c4 |
for dev in self.get_luks_devices(lsblk_file):
|
|
|
fce3c4 |
--
|
|
|
fce3c4 |
2.17.2
|
|
|
fce3c4 |
|