Skip to content

Commit 51c7dad

Browse files
committed
Display last time re-encrypted in pool detail view
Signed-off-by: mulhern <amulhern@redhat.com>
1 parent e0f409b commit 51c7dad

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/stratis_cli/_actions/_list_pool.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from uuid import UUID
3030

3131
# isort: THIRDPARTY
32+
from dateutil import parser as date_parser
3233
from justbytes import Range
3334

3435
from .._alerts import (
@@ -383,6 +384,14 @@ def _print_detail_view(
383384
if encrypted:
384385
print("Encryption Enabled: Yes")
385386

387+
(valid, timestamp) = mopool.LastReencryptedTimestamp()
388+
reencrypted = (
389+
date_parser.isoparse(timestamp).astimezone().strftime("%b %d %Y %H:%M")
390+
if valid
391+
else "Never"
392+
)
393+
print(f" Last Time Reencrypted: {reencrypted}")
394+
386395
if metadata_version is MetadataVersion.V1: # pragma: no cover
387396
key_description_str = _non_existent_or_inconsistent_to_str(
388397
EncryptionInfoKeyDescription(mopool.KeyDescriptions())

tests/integration/pool/test_encryption.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ def test_reencrypt_with_name(self):
536536
]
537537
RUNNER(command_line)
538538

539+
# Exercise detail view with last reencryption time set
540+
command_line = ["--propagate", "pool", "list", f"--name={self._POOLNAME}"]
541+
RUNNER(command_line)
542+
539543

540544
class ReencryptTestCase2(SimTestCase):
541545
"""

0 commit comments

Comments
 (0)