From: Ujjawal Anand Date: Thu, 20 Nov 2025 11:17:14 +0000 (+0530) Subject: Handle whitespace in upgrade daemon types X-Git-Tag: v21.0.1~426^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=541e660e7e39413a35cc0e1052b36a4a36698617;p=ceph.git Handle whitespace in upgrade daemon types Resolves: https://tracker.ceph.com/issues/75153 Signed-off-by: Ujjawal Anand --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index aec32f1fb7b0..89c4696ee1f2 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -4087,6 +4087,9 @@ Then run the following: if daemon_types is not None and services is not None: raise OrchestratorError('--daemon-types and --services are mutually exclusive') if daemon_types is not None: + # Strip any whitespace around daemon types provided via the CLI so that + # `--daemon_types "mon, crash"` is treated the same as `--daemon_types "mon,crash"`. + daemon_types = [dtype.strip() for dtype in daemon_types] for dtype in daemon_types: if dtype not in utils.CEPH_IMAGE_TYPES: raise OrchestratorError(f'Upgrade aborted - Got unexpected daemon type "{dtype}".\n' diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index b570e8ced27f..8257ce91f339 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -2570,8 +2570,9 @@ Usage: ceph_version: Optional[str] = None) -> HandleCommandResult: """Initiate upgrade""" self._upgrade_check_image_name(image, ceph_version) - dtypes = daemon_types.split(',') if daemon_types is not None else None - service_names = services.split(',') if services is not None else None + # Split comma-separated lists and trim whitespace so "mon, crash" and "mon,crash" are equivalent. + dtypes = [d.strip() for d in daemon_types.split(',')] if daemon_types is not None else None + service_names = [s.strip() for s in services.split(',')] if services is not None else None completion = self.upgrade_start(image, ceph_version, dtypes, hosts, service_names, limit) raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str())