Skip to content

Commit b9034cb

Browse files
committed
Abstract generation of alerts string for table view
Signed-off-by: mulhern <amulhern@redhat.com>
1 parent c976c29 commit b9034cb

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/stratis_cli/_actions/_list_pool.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,24 @@ def gen_string(has_property: bool, code: str) -> str:
537537
(objpath, MOPool(info)) for objpath, info in pools().search(managed_objects)
538538
]
539539

540+
def alerts_str(mopool: Any, pool_object_path: str) -> str:
541+
return ", ".join(
542+
sorted(
543+
str(code)
544+
for code in (
545+
Default.alert_codes(mopool)
546+
+ alerts.alert_codes(pool_object_path)
547+
)
548+
)
549+
)
550+
540551
tables = [
541552
(
542553
Default.name_str(mopool),
543554
physical_size_triple(mopool),
544555
properties_string(mopool),
545556
self.uuid_str(mopool),
546-
", ".join(
547-
sorted(
548-
str(code)
549-
for code in (
550-
Default.alert_codes(mopool)
551-
+ alerts.alert_codes(pool_object_path)
552-
)
553-
)
554-
),
557+
alerts_str(mopool, pool_object_path),
555558
)
556559
for (pool_object_path, mopool) in pools_with_props
557560
]

0 commit comments

Comments
 (0)