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

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'
parse_content(content)[source]

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