Skip to content

Commit d82fa3e

Browse files
jcastillpmoravec
authored andcommitted
[block] Capture 'cryptsetup status'
Capture the output of 'cryptsetup status' Related: RHELMISC-16751 Signed-off-by: Jose Castillo <jcastillo@redhat.com>
1 parent 9168377 commit d82fa3e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

sos/report/plugins/block.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# See the LICENSE file in the source distribution for further information.
88

9-
from sos.report.plugins import Plugin, IndependentPlugin
9+
from sos.report.plugins import Plugin, IndependentPlugin, SoSPredicate
1010

1111

1212
class Block(Plugin, IndependentPlugin):
@@ -70,7 +70,15 @@ def setup(self):
7070
dev = line.split()[0]
7171
self.add_cmd_output(f'cryptsetup luksDump /dev/{dev}')
7272
self.add_cmd_output(f'clevis luks list -d /dev/{dev}')
73-
73+
# cryptsetup status needs the device-mapper
74+
# table name for the crypt target
75+
luks_map = self.collect_cmd_output("dmsetup table --target crypt",
76+
pred=SoSPredicate(self,
77+
kmods=['dm_mod']))
78+
if luks_map['status'] == 0:
79+
for line in luks_map['output'].splitlines():
80+
dev = line.split(':')[0]
81+
self.add_cmd_output(f'cryptsetup status /dev/mapper/{dev}')
7482
self.add_copy_spec("/etc/crypttab")
7583

7684
# vim: set et ts=4 sw=4 :

0 commit comments

Comments
 (0)