From 048840ac99251bff328d7b963de90e6ff401e68c Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Thu, 11 Jun 2020 16:00:21 -0400 Subject: [PATCH] Stringify numbers --- src/allmydata/web/check_results.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/allmydata/web/check_results.py b/src/allmydata/web/check_results.py index 757326bf7..c1edb799c 100644 --- a/src/allmydata/web/check_results.py +++ b/src/allmydata/web/check_results.py @@ -702,45 +702,48 @@ class DeepCheckAndRepairResultsRendererElement(Element, ResultsBase, ReloadMixin def root_storage_index(self, req, tag): return self.monitor.get_status().get_root_storage_index_string() + def _get_counter(self, name): + return str(self.monitor.get_status().get_counters().get(name)) + @renderer def objects_checked(self, req, tag): - return self.monitor.get_status().get_counters()["count-objects-checked"] + return self._get_counter("count-objects-checked") @renderer def objects_healthy(self, req, tag): - return self.monitor.get_status().get_counters()["count-objects-healthy-pre-repair"] + return self._get_counter("count-objects-healthy-pre-repair") @renderer def objects_unhealthy(self, req, tag): - return self.monitor.get_status().get_counters()["count-objects-unhealthy-pre-repair"] + return self._get_counter("count-objects-unhealthy-pre-repair") @renderer def corrupt_shares(self, req, tag): - return self.monitor.get_status().get_counters()["count-corrupt-shares-pre-repair"] + return self._get_counter("count-corrupt-shares-pre-repair") @renderer def repairs_attempted(self, req, tag): - return self.monitor.get_status().get_counters()["count-repairs-attempted"] + return self._get_counter("count-repairs-attempted") @renderer def repairs_successful(self, req, tag): - return self.monitor.get_status().get_counters()["count-repairs-successful"] + return self._get_counter("count-repairs-successful") @renderer def repairs_unsuccessful(self, req, tag): - return self.monitor.get_status().get_counters()["count-repairs-unsuccessful"] + return self._get_counter("count-repairs-unsuccessful") @renderer def objects_healthy_post(self, req, tag): - return self.monitor.get_status().get_counters()["count-objects-healthy-post-repair"] + return self._get_counter("count-objects-healthy-post-repair") @renderer def objects_unhealthy_post(self, req, tag): - return self.monitor.get_status().get_counters()["count-objects-unhealthy-post-repair"] + return self._get_counter("count-objects-unhealthy-post-repair") @renderer def corrupt_shares_post(self, req, tag): - return self.monitor.get_status().get_counters()["count-corrupt-shares-post-repair"] + return self._get_counter("count-corrupt-shares-post-repair") @renderer def pre_repair_problems_p(self, req, tag):