Skip to content

Commit

Permalink
Deal with multiple instances of encryption information
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Jan 8, 2025
1 parent bbdd77d commit 72649cf
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/stratis_cli/_actions/_list_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"""

# isort: STDLIB
import json
from abc import ABC, abstractmethod

# isort: THIRDPARTY
Expand All @@ -33,12 +34,7 @@
print_table,
size_triple,
)
from ._utils import (
EncryptionInfoClevis,
EncryptionInfoKeyDescription,
PoolFeature,
StoppedPool,
)
from ._utils import ClevisInfo, PoolFeature, StoppedPool


def _fetch_stopped_pools_property(proxy):
Expand Down Expand Up @@ -270,16 +266,14 @@ def _print_detail_view(self, mopool, size_change_codes):
if encrypted:
print("Encryption Enabled: Yes")

key_description_str = _non_existent_or_inconsistent_to_str(
EncryptionInfoKeyDescription(mopool.KeyDescription())
)
print(f" Key Description: {key_description_str}")
for token_slot, description in mopool.KeyDescriptions():
print(f" Token Slot: {token_slot}, Key Description: {description}")

clevis_info_str = _non_existent_or_inconsistent_to_str(
EncryptionInfoClevis(mopool.ClevisInfo()),
interp=_clevis_to_str, # pyright: ignore [ reportArgumentType ]
)
print(f" Clevis Configuration: {clevis_info_str}")
for token_slot, (pin, config) in mopool.ClevisInfos():
print(
f" Token Slot: {token_slot}, Clevis Configuration: "
f"{_clevis_to_str(ClevisInfo(pin, json.loads(str(config))))}"
)

else:
print("Encryption Enabled: No")
Expand Down

0 comments on commit 72649cf

Please sign in to comment.