From 46f00a7bd7f38a1e2f3b301cd94c5d22b60bcc5a Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Thu, 18 Mar 2021 15:41:06 -0600 Subject: [PATCH] cephadm: use debug verbosity during container exec avoid failures from appearing on the consle when exec'ing within the container during the `ls` command Signed-off-by: Michael Fritch --- src/cephadm/cephadm | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 75be85f3c6dd2..38e5d39e83886 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -289,14 +289,14 @@ class Monitoring(object): _, err, code = call(ctx, [ ctx.container_path, 'exec', container_id, cmd, '--version' - ], verbosity=CallVerbosity.SILENT) + ], verbosity=CallVerbosity.DEBUG) if code == 0: break cmd = 'alertmanager' # reset cmd for version extraction else: _, err, code = call(ctx, [ ctx.container_path, 'exec', container_id, cmd, '--version' - ]) + ], verbosity=CallVerbosity.DEBUG) if code == 0 and \ err.startswith('%s, version ' % cmd): version = err.split(' ')[2] @@ -386,7 +386,8 @@ class NFSGanesha(object): version = None out, err, code = call(ctx, [ctx.container_path, 'exec', container_id, - NFSGanesha.entrypoint, '-v']) + NFSGanesha.entrypoint, '-v'], + verbosity=CallVerbosity.DEBUG) if code == 0: match = re.search(r'NFS-Ganesha Release\s*=\s*[V]*([\d.]+)', out) if match: @@ -547,7 +548,8 @@ class CephIscsi(object): version = None out, err, code = call(ctx, [ctx.container_path, 'exec', container_id, - '/usr/bin/python3', '-c', "import pkg_resources; print(pkg_resources.require('ceph_iscsi')[0].version)"]) + '/usr/bin/python3', '-c', "import pkg_resources; print(pkg_resources.require('ceph_iscsi')[0].version)"], + verbosity=CallVerbosity.DEBUG) if code == 0: version = out.strip() return version @@ -4596,7 +4598,9 @@ def list_daemons(ctx, detail=True, legacy_dir=None): check_unit(ctx, legacy_unit_name) if not host_version: try: - out, err, code = call(ctx, ['ceph', '-v']) + out, err, code = call(ctx, + ['ceph', '-v'], + verbosity=CallVerbosity.DEBUG) if not code and out.startswith('ceph version '): host_version = out.split(' ')[2] except Exception: @@ -4669,7 +4673,8 @@ def list_daemons(ctx, detail=True, legacy_dir=None): if daemon_type in Ceph.daemons: out, err, code = call(ctx, [container_path, 'exec', container_id, - 'ceph', '-v']) + 'ceph', '-v'], + verbosity=CallVerbosity.DEBUG) if not code and \ out.startswith('ceph version '): version = out.split(' ')[2] @@ -4677,7 +4682,8 @@ def list_daemons(ctx, detail=True, legacy_dir=None): elif daemon_type == 'grafana': out, err, code = call(ctx, [container_path, 'exec', container_id, - 'grafana-server', '-v']) + 'grafana-server', '-v'], + verbosity=CallVerbosity.DEBUG) if not code and \ out.startswith('Version '): version = out.split(' ')[1] @@ -4690,7 +4696,8 @@ def list_daemons(ctx, detail=True, legacy_dir=None): elif daemon_type == 'haproxy': out, err, code = call(ctx, [container_path, 'exec', container_id, - 'haproxy', '-v']) + 'haproxy', '-v'], + verbosity=CallVerbosity.DEBUG) if not code and \ out.startswith('HA-Proxy version '): version = out.split(' ')[2] @@ -4698,7 +4705,8 @@ def list_daemons(ctx, detail=True, legacy_dir=None): elif daemon_type == 'keepalived': out, err, code = call(ctx, [container_path, 'exec', container_id, - 'keepalived', '--version']) + 'keepalived', '--version'], + verbosity=CallVerbosity.DEBUG) if not code and \ err.startswith('Keepalived '): version = err.split(' ')[1] -- 2.39.5