From 26de97d09375f8ec48d69b96aa6d4a7a61d1c099 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 7 Mar 2020 10:06:40 -0600 Subject: [PATCH] mgr/cephadm: sanity check upgrade version Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/module.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 8cc007e6b176a..d86d01556fcca 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2789,6 +2789,14 @@ receivers: raise OrchestratorError('upgrade is not supported in %s mode' % ( self.mode)) if version: + try: + (major, minor, patch) = version.split('.') + assert int(minor) >= 0 + assert int(patch) >= 0 + except: + raise OrchestratorError('version must be in the form X.Y.Z (e.g., 15.2.3)') + if int(major) < 15 or (int(major) == 15 and int(minor) < 2): + raise OrchestratorError('cephadm only supports octopus (15.2.0) or later') target_name = self.container_image_base + ':v' + version elif image: target_name = image -- 2.39.5