From: zhengyin Date: Wed, 6 Nov 2019 03:57:40 +0000 (+0800) Subject: pybind/mgr: Cancel output color control X-Git-Tag: v12.2.13~26^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F31696%2Fhead;p=ceph.git pybind/mgr: Cancel output color control When I do "ceph osd status" command, the units are not visible when using a black background, So cancel outpul color control Fixes: https://tracker.ceph.com/issues/42517 Signed-off-by: Zheng Yin (cherry picked from commit ca2675e215acc8fbfb2d730b9c1f9f3aafc3e67d) Conflicts: - path: rc/pybind/mgr/mgr_util.py comment: mgr_util.py in luminous is status/module.py --- diff --git a/src/pybind/mgr/status/module.py b/src/pybind/mgr/status/module.py index acedbff906ab..a164c058565a 100644 --- a/src/pybind/mgr/status/module.py +++ b/src/pybind/mgr/status/module.py @@ -63,10 +63,10 @@ class Module(MgrModule): """ Format a number without units, so as to fit into `width` characters, substituting an appropriate unit suffix. - + Use decimal for dimensionless things, use base 2 (decimal=False) for byte sizes/rates. """ - + factor = 1000 if decimal else 1024 units = [' ', 'k', 'M', 'G', 'T', 'P'] unit = 0 @@ -91,12 +91,12 @@ class Module(MgrModule): else: return formatted - def format_dimless(self, n, width, colored=True): + def format_dimless(self, n, width, colored=False): return self.format_units(n, width, colored, decimal=True) - - def format_bytes(self, n, width, colored=True): + + def format_bytes(self, n, width, colored=False): return self.format_units(n, width, colored, decimal=False) - + def get_latest(self, daemon_type, daemon_name, stat): data = self.get_counter(daemon_type, daemon_name, stat)[stat] #self.log.error("get_latest {0} data={1}".format(stat, data))