diff --git a/src/stratis_cli/_actions/_list_pool.py b/src/stratis_cli/_actions/_list_pool.py index 9aaf4e0d4..4319ef0d7 100644 --- a/src/stratis_cli/_actions/_list_pool.py +++ b/src/stratis_cli/_actions/_list_pool.py @@ -249,19 +249,6 @@ def __init__(self, uuid_formatter, selection): self.uuid_formatter = uuid_formatter self.selection = selection - @staticmethod - def alert_summary(codes): - """ - Alert summary to display, if any - - :param codes: list of error codes to display - :type codes: list of PoolErrorCode - - :returns: string with alert summary - :rtype: str - """ - return [f"{code}: {code.summarize()}" for code in codes] - def _print_detail_view(self, mopool, size_change_codes): """ Print the detailed view for a single pool. @@ -276,7 +263,10 @@ def _print_detail_view(self, mopool, size_change_codes): print(f"UUID: {self.uuid_formatter(mopool.Uuid())}") print(f"Name: {mopool.Name()}") - alert_summary = self.alert_summary(self.alert_codes(mopool) + size_change_codes) + alert_summary = [ + f"{code}: {code.summarize()}" + for code in (self.alert_codes(mopool) + size_change_codes) + ] print(f"Alerts: {len(alert_summary)}") for line in alert_summary: # pragma: no cover print(f" {line}") @@ -395,19 +385,6 @@ def __init__(self, uuid_formatter): """ self.uuid_formatter = uuid_formatter - @staticmethod - def alert_string(codes): - """ - Alert information to display, if any - - :param codes: list of error codes to display - :type codes: list of PoolErrorCode - - :returns: string w/ alert information, "" if no alert - :rtype: str - """ - return ", ".join(sorted(str(code) for code in codes)) - def display(self): """ List pools in table view. @@ -484,9 +461,14 @@ def gen_string(has_property, code): physical_size_triple(mopool), properties_string(mopool), self.uuid_formatter(mopool.Uuid()), - self.alert_string( - self.alert_codes(mopool) - + self._from_sets(pool_object_path, increased, decreased) + ", ".join( + sorted( + str(code) + for code in ( + self.alert_codes(mopool) + + self._from_sets(pool_object_path, increased, decreased) + ) + ) ), ) for (pool_object_path, mopool) in pools_with_props