]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: capture exception when not able to list upgrade tags 46445/head
authorRedouane Kachach <rkachach@redhat.com>
Tue, 31 May 2022 10:59:26 +0000 (12:59 +0200)
committerRedouane Kachach <rkachach@redhat.com>
Wed, 1 Jun 2022 08:19:38 +0000 (10:19 +0200)
Fixes: https://tracker.ceph.com/issues/55801
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
src/pybind/mgr/cephadm/registry.py
src/pybind/mgr/cephadm/upgrade.py

index 7b293a4c1a5280cb1e71db63e359885966716bc3..31e5fb23e807bc0453c43fd1efc8c0dfb7420a85 100644 (file)
@@ -39,7 +39,11 @@ class Registry:
         headers = {'Accept': 'application/json'}
         url = f'https://{self.api_domain}/v2/{image}/tags/list'
         while True:
-            r = requests.get(url, headers=headers)
+            try:
+                r = requests.get(url, headers=headers)
+            except requests.exceptions.ConnectionError as e:
+                msg = f"Cannot get tags from url '{url}': {e}"
+                raise ValueError(msg) from e
             if r.status_code == 401:
                 if 'Authorization' in headers:
                     raise ValueError('failed authentication')
index d41b9286ec223c5c3889b539e465f647b7e30f21..d1b3c098ff77ba37de198a0b15a1de51b6f43534 100644 (file)
@@ -267,7 +267,11 @@ class CephadmUpgrade:
             "registry": reg_name,
             "bare_image": bare_image,
         }
-        ls = reg.get_tags(bare_image)
+
+        try:
+            ls = reg.get_tags(bare_image)
+        except ValueError as e:
+            raise OrchestratorError(f'{e}')
         if not tags:
             for t in ls:
                 if t[0] != 'v':