From fbe5208d79c582307a1fa815e5e4deb8d6cddb7a Mon Sep 17 00:00:00 2001 From: Pragadeeswaran Sathyanarayanan Date: Fri, 20 Sep 2024 14:17:36 +0530 Subject: [PATCH] Reduce the noise that is being generated with the new exec_command This commit attempts to reduce the noise that is being generated with the new exec_command. Here, we remove gather cluster status for every orch operation as cephadm has evolved. The verbose logging is disabled in cephadm as it is logging to stderr. Switching to pretty_print for cases it is required. Signed-off-by: Pragadeeswaran Sathyanarayanan --- ceph/ceph_admin/helper.py | 4 +--- ceph/ceph_admin/shell.py | 5 ++++- tests/ceph_installer/test_cephadm.py | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ceph/ceph_admin/helper.py b/ceph/ceph_admin/helper.py index 694d1a9b16..cbee6a458c 100644 --- a/ceph/ceph_admin/helper.py +++ b/ceph/ceph_admin/helper.py @@ -861,9 +861,7 @@ def get_cluster_state(cls, commands=None): __CLUSTER_STATE_COMMANDS.extend(commands) for cmd in __CLUSTER_STATE_COMMANDS: - out, err = cls.shell(args=[cmd]) - LOG.info("STDOUT:\n %s" % out) - LOG.error("STDERR:\n %s" % err) + cls.shell(args=[cmd], pretty_print=True) def get_host_osd_map(cls): diff --git a/ceph/ceph_admin/shell.py b/ceph/ceph_admin/shell.py index 063ec83b00..23ac826015 100644 --- a/ceph/ceph_admin/shell.py +++ b/ceph/ceph_admin/shell.py @@ -9,7 +9,7 @@ from .typing_ import CephAdmProtocol LOG = Log(__name__) -BASE_CMD = ["cephadm", "-v", "shell"] +BASE_CMD = ["cephadm", "shell"] class ShellMixin: @@ -23,6 +23,7 @@ def shell( timeout: int = 600, long_running: bool = False, print_output: bool = True, + pretty_print: bool = False, ): """ Ceph orchestrator shell interface to run ceph commands. @@ -34,6 +35,7 @@ def shell( timeout (Int): Maximum time allowed for execution. long_running (Bool): Long running command (default: False) print_output ( Bool): Flag to decide whether the output should be printed in log or not + pretty_print (Bool): Flag to decide whether the output should be printed or not Returns: out (Str), err (Str) stdout and stderr response @@ -54,6 +56,7 @@ def shell( timeout=timeout, check_ec=check_status, long_running=long_running, + pretty_print=pretty_print, ) if isinstance(out, tuple): diff --git a/tests/ceph_installer/test_cephadm.py b/tests/ceph_installer/test_cephadm.py index be59138128..00f12a9c28 100644 --- a/tests/ceph_installer/test_cephadm.py +++ b/tests/ceph_installer/test_cephadm.py @@ -187,8 +187,7 @@ def run(ceph_cluster: Ceph, **kwargs) -> int: except BaseException as be: # noqa LOG.error(be, exc_info=True) - return 1 - finally: LOG.debug("Gathering cluster state after running test_cephadm") get_cluster_state(cephadm) + return 0