luksmeta - command luksmeta show -d <device_name>

This class provides parsing for the output of luksmeta <device_name>.

class insights.parsers.luksmeta.KeyslotSpecification(index, state, metadata)[source]

Bases: object

Class KeyslotSpecification describes information about a keyslot collected by the luksmeta show command.

index

the index of the described keyslot

Type:

int

state

the state of the described keyslot

Type:

str

metadata

the UUID of the application that stored metadata into the described keyslot

Type:

str

class insights.parsers.luksmeta.LuksMeta(context)[source]

Bases: CommandParser, dict

Class LuksMeta parses the output of the luksmeta show -d <device> command.

This command prints information if the device has custom user-defined metadata embedded in the keyslots (used e.g. by clevis). If the device was not initialized using luksmeta, the parser raises SkipComponent.

The parser can be indexed by the keyslot index (in the range 0-7). A KeyslotSpecification object is returned, which describes every LUKS keyslot. The KeyslotSpecification contains the index, state and metadata fileds. Metadata field stores the UUID of the application that has stored metadata in the keyslot.

Sample input data is in the format:

0   active empty
1   active cb6e8904-81ff-40da-a84a-07ab9ab5715e
2   active empty
3   active empty
4 inactive empty
5   active empty
6   active cb6e8904-81ff-40da-a84a-07ab9ab5715e
7   active cb6e8904-81ff-40da-a84a-07ab9ab5715e
device_uuid

UUID of the LUKS device

Type:

str

key_slot_ids

List of LUKS keyslot id which can be used to retrieve the keyslot metadata.

Type:

list

Examples

>>> type(parsed_result)
<class 'insights.parsers.luksmeta.LuksMeta'>
>>> parsed_result[0].index
0
>>> parsed_result[0].state
'active'
>>> parsed_result[4].state
'inactive'
>>> parsed_result[0].metadata is None
True
>>> parsed_result[1].metadata
'cb6e8904-81ff-40da-a84a-07ab9ab5715e'
>>> parsed_result.device_uuid
'd62357eb-ea88-4b13-b756-a24e91fbfe9a'
>>> parsed_result.key_slot_ids
[0, 1, 2, 3, 4, 5, 6, 7]
parse_content(content)[source]

This method must be implemented by classes based on this class.