]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Using '.ID' instead of '.Id' which is only supported by podman 45598/head
authorRedouane Kachach <rkachach@redhat.com>
Fri, 22 Apr 2022 13:53:34 +0000 (15:53 +0200)
committerRedouane Kachach <rkachach@redhat.com>
Fri, 22 Apr 2022 13:53:34 +0000 (15:53 +0200)
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
src/cephadm/cephadm
src/cephadm/tests/test_cephadm.py

index 94de89a3b246c82606f3e0fdaf3e340ef7bff9c6..c61c568710438bf09017e8b3c53c623dde690f36 100755 (executable)
@@ -2115,7 +2115,7 @@ def infer_local_ceph_image(ctx: CephadmContext, container_path: str) -> Optional
                             [container_path, 'images',
                              '--filter', 'label=ceph=True',
                              '--filter', 'dangling=false',
-                             '--format', '{{.Repository}}@{{.Digest}}|{{.Id}}|{{.Tag}}|{{.CreatedAt}}'])
+                             '--format', '{{.Repository}}@{{.Digest}}|{{.ID}}|{{.Tag}}|{{.CreatedAt}}'])
 
     container_info = None
     daemon_name = ctx.name if ('name' in ctx and ctx.name and '.' in ctx.name) else None
@@ -2129,10 +2129,10 @@ def infer_local_ceph_image(ctx: CephadmContext, container_path: str) -> Optional
     for image in out.splitlines():
         if image and not image.isspace():
             (digest, image_id, tag, created_date) = image.lstrip().split('|')
-            if container_info is not None and container_info.image_id != image_id:
+            if container_info is not None and image_id not in container_info.image_id:
                 continue
             if digest and not digest.endswith('@'):
-                logger.info(f"Using ceph image with id '{image_id[:12]}' and tag '{tag}' created on {created_date}\n{digest}")
+                logger.info(f"Using ceph image with id '{image_id}' and tag '{tag}' created on {created_date}\n{digest}")
                 return digest
     return None
 
index 3ebd81081e08eaffa332ac96bb44c748f0ba571a..c514befb080829f3bbb21e7830156bb146aeab58 100644 (file)
@@ -361,18 +361,18 @@ class TestCephAdm(object):
                                  '514e6a882f6e74806a5856468489eeff8d7106095557578da96935e4d0ba4d9d',
                                  '2022-04-19 13:45:20.97146228 +0000 UTC',
                                  '')
-        out = '''quay.ceph.io/ceph-ci/ceph@sha256:87f200536bb887b36b959e887d5984dd7a3f008a23aa1f283ab55d48b22c6185|dad864ee21e98e69f4029d1e417aa085001566be0d322fbc75bc6f29b0050c01|master|2022-03-23 16:29:19 +0000 UTC
-        quay.ceph.io/ceph-ci/ceph@sha256:b50b130fcda2a19f8507ddde3435bb4722266956e1858ac395c838bc1dcf1c0e|514e6a882f6e74806a5856468489eeff8d7106095557578da96935e4d0ba4d9d|pacific|2022-03-23 15:58:34 +0000 UTC
-        docker.io/ceph/ceph@sha256:939a46c06b334e094901560c8346de33c00309e3e3968a2db240eb4897c6a508|666bbfa87e8df05702d6172cae11dd7bc48efb1d94f1b9e492952f19647199a4|v15.2.5|2020-09-16 14:15:15 +0000 UTC'''
+        out = '''quay.ceph.io/ceph-ci/ceph@sha256:87f200536bb887b36b959e887d5984dd7a3f008a23aa1f283ab55d48b22c6185|dad864ee21e9|master|2022-03-23 16:29:19 +0000 UTC
+        quay.ceph.io/ceph-ci/ceph@sha256:b50b130fcda2a19f8507ddde3435bb4722266956e1858ac395c838bc1dcf1c0e|514e6a882f6e|pacific|2022-03-23 15:58:34 +0000 UTC
+        docker.io/ceph/ceph@sha256:939a46c06b334e094901560c8346de33c00309e3e3968a2db240eb4897c6a508|666bbfa87e8d|v15.2.5|2020-09-16 14:15:15 +0000 UTC'''
         with mock.patch('cephadm.call_throws', return_value=(out, '', '')):
             with mock.patch('cephadm.get_container_info', return_value=cinfo):
                 image = cd.infer_local_ceph_image(ctx, ctx.container_engine)
                 assert image == 'quay.ceph.io/ceph-ci/ceph@sha256:b50b130fcda2a19f8507ddde3435bb4722266956e1858ac395c838bc1dcf1c0e'
 
         # make sure first valid image is used when no container_info is found
-        out = '''quay.ceph.io/ceph-ci/ceph@sha256:87f200536bb887b36b959e887d5984dd7a3f008a23aa1f283ab55d48b22c6185|dad864ee21e98e69f4029d1e417aa085001566be0d322fbc75bc6f29b0050c01|master|2022-03-23 16:29:19 +0000 UTC
-        quay.ceph.io/ceph-ci/ceph@sha256:b50b130fcda2a19f8507ddde3435bb4722266956e1858ac395c838bc1dcf1c0e|514e6a882f6e74806a5856468489eeff8d7106095557578da96935e4d0ba4d9d|pacific|2022-03-23 15:58:34 +0000 UTC
-        docker.io/ceph/ceph@sha256:939a46c06b334e094901560c8346de33c00309e3e3968a2db240eb4897c6a508|666bbfa87e8df05702d6172cae11dd7bc48efb1d94f1b9e492952f19647199a4|v15.2.5|2020-09-16 14:15:15 +0000 UTC'''
+        out = '''quay.ceph.io/ceph-ci/ceph@sha256:87f200536bb887b36b959e887d5984dd7a3f008a23aa1f283ab55d48b22c6185|dad864ee21e9|master|2022-03-23 16:29:19 +0000 UTC
+        quay.ceph.io/ceph-ci/ceph@sha256:b50b130fcda2a19f8507ddde3435bb4722266956e1858ac395c838bc1dcf1c0e|514e6a882f6e|pacific|2022-03-23 15:58:34 +0000 UTC
+        docker.io/ceph/ceph@sha256:939a46c06b334e094901560c8346de33c00309e3e3968a2db240eb4897c6a508|666bbfa87e8d|v15.2.5|2020-09-16 14:15:15 +0000 UTC'''
         with mock.patch('cephadm.call_throws', return_value=(out, '', '')):
             with mock.patch('cephadm.get_container_info', return_value=None):
                 image = cd.infer_local_ceph_image(ctx, ctx.container_engine)
@@ -381,7 +381,7 @@ class TestCephAdm(object):
         # make sure images without digest are discarded (no container_info is found)
         out = '''quay.ceph.io/ceph-ci/ceph@|||
         docker.io/ceph/ceph@|||
-        docker.io/ceph/ceph@sha256:939a46c06b334e094901560c8346de33c00309e3e3968a2db240eb4897c6a508|666bbfa87e8df05702d6172cae11dd7bc48efb1d94f1b9e492952f19647199a4|v15.2.5|2020-09-16 14:15:15 +0000 UTC'''
+        docker.io/ceph/ceph@sha256:939a46c06b334e094901560c8346de33c00309e3e3968a2db240eb4897c6a508|666bbfa87e8d|v15.2.5|2020-09-16 14:15:15 +0000 UTC'''
         with mock.patch('cephadm.call_throws', return_value=(out, '', '')):
             with mock.patch('cephadm.get_container_info', return_value=None):
                 image = cd.infer_local_ceph_image(ctx, ctx.container_engine)