From 37aefdd5ae0330951be53b3501c8013709c19c17 Mon Sep 17 00:00:00 2001 From: Adam King Date: Wed, 15 Mar 2023 13:55:26 -0400 Subject: [PATCH] cephadm: handle exceptions applying secondary services during bootstrap Otherwise we risk hitting a mismatch between the cephadm binary version and the container image version we're bootstrapping on, resulting in bootstrap failing. Example in the tracker. Fixes: https://tracker.ceph.com/issues/59082 Signed-off-by: Adam King (cherry picked from commit a57fc000cc40066dff8692f489e4942d5bda1f56) --- src/cephadm/cephadm.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index dae9dbd529eac..d8c80361fb912 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -5422,12 +5422,22 @@ def prepare_ssh( if not ctx.skip_monitoring_stack: for t in ['ceph-exporter', 'prometheus', 'grafana', 'node-exporter', 'alertmanager']: logger.info('Deploying %s service with default placement...' % t) - cli(['orch', 'apply', t]) + try: + cli(['orch', 'apply', t]) + except RuntimeError: + ctx.error_code = -errno.EINVAL + logger.error(f'Failed to apply service type {t}. ' + 'Perhaps the ceph version being bootstrapped does not support it') if ctx.with_centralized_logging: for t in ['loki', 'promtail']: logger.info('Deploying %s service with default placement...' % t) - cli(['orch', 'apply', t]) + try: + cli(['orch', 'apply', t]) + except RuntimeError: + ctx.error_code = -errno.EINVAL + logger.error(f'Failed to apply service type {t}. ' + 'Perhaps the ceph version being bootstrapped does not support it') def enable_cephadm_mgr_module( -- 2.39.5