aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-04-20 18:00:07 -0400
committerJake Hunsaker <jhunsake@redhat.com>2020-04-22 11:03:46 -0400
commitd63288a6c7e485661dded7e6425fa65d5f8de716 (patch)
tree0ab5c60d8f528f6ae060cec3153f3dee83cfb83c
parent35eacf2487c14eafa9082721d273d818c37a29b7 (diff)
downloadsos-d63288a6c7e485661dded7e6425fa65d5f8de716.tar.gz
[cluster] Improve logging formating for errors
Removes the header formatted for error level messages, as these are printed to console directly. Additionally improves the formatting of the error message used when we could not get a list of nodes from the cluster. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/collector/clusters/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/sos/collector/clusters/__init__.py b/sos/collector/clusters/__init__.py
index a4804e4f..a112ff49 100644
--- a/sos/collector/clusters/__init__.py
+++ b/sos/collector/clusters/__init__.py
@@ -64,7 +64,7 @@ class Cluster():
self.options.append(option)
def _fmt_msg(self, msg):
- return '[%s] %s' % (self.cluster_type, msg)
+ return '[%s] %s' % (self.cluster_type[0], msg)
def log_info(self, msg):
"""Used to print info messages"""
@@ -72,7 +72,7 @@ class Cluster():
def log_error(self, msg):
"""Used to print error messages"""
- self.soslog.error(self._fmt_msg(msg))
+ self.soslog.error(msg)
def log_debug(self, msg):
"""Used to print debug messages"""
@@ -170,8 +170,7 @@ class Cluster():
try:
nodes = self.get_nodes()
except Exception as e:
- self.log_error('\n%s failed to enumerate nodes: %s'
- % (self.cluster_type, e))
+ self.log_error('Cluster failed to enumerate nodes: %s' % e)
raise
if isinstance(nodes, list):
node_list = [n.strip() for n in nodes if n]