]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: don't have upgrade fail if "." in patch section of version
authorAdam King <adking@redhat.com>
Mon, 29 Mar 2021 19:01:23 +0000 (15:01 -0400)
committerSage Weil <sage@newdream.net>
Thu, 1 Apr 2021 14:08:35 +0000 (09:08 -0500)
Fixes: https://tracker.ceph.com/issues/50043
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit e03f0fff5032314eb08059403c44bac3a5037f57)

src/pybind/mgr/cephadm/upgrade.py

index 41a2aa5f2f8cbc3edaead0a78ac064c1206700a1..3fb4a50a0cdfd88382cfa4c03185d07957d1b0fc 100644 (file)
@@ -127,7 +127,7 @@ class CephadmUpgrade:
 
     def _check_target_version(self, version: str) -> Optional[str]:
         try:
-            (major, minor, patch) = version.split('.')
+            (major, minor, _) = version.split('.', 2)
             assert int(minor) >= 0
             # patch might be a number or {number}-g{sha1}
         except ValueError:
@@ -137,7 +137,7 @@ class CephadmUpgrade:
 
         # to far a jump?
         current_version = self.mgr.version.split('ceph version ')[1]
-        current_major, current_minor, current_patch = current_version.split('-')[0].split('.')
+        (current_major, current_minor, _) = current_version.split('-')[0].split('.', 2)
         if int(current_major) < int(major) - 2:
             return f'ceph can only upgrade 1 or 2 major versions at a time; {current_version} -> {version} is too big a jump'
         if int(current_major) > int(major):
@@ -438,7 +438,7 @@ class CephadmUpgrade:
             # tolerate/fix upgrade state from older version
             self.upgrade_state.target_version = target_version.split(' ')[2]
             target_version = self.upgrade_state.target_version
-        target_major, target_minor, target_patch = target_version.split('.')
+        (target_major, _) = target_version.split('.', 1)
         target_major_name = self.mgr.lookup_release_name(int(target_major))
 
         if first: