]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: fix inspect-image 33109/head
authorSage Weil <sage@redhat.com>
Thu, 6 Feb 2020 15:18:13 +0000 (09:18 -0600)
committerSage Weil <sage@redhat.com>
Thu, 6 Feb 2020 15:18:13 +0000 (09:18 -0600)
This was broken by d8debba782cd4f40ed13db7f1af8ef43503ccec5
because the 'images' json output works with podman but not with
docker.  (Also, the inspect command is more explicit and cleaner.)

Signed-off-by: Sage Weil <sage@redhat.com>
src/cephadm/cephadm

index 01478d2768502560ef9ef1541b771d12146ae602..ea1012f557a217a77d88bee9beef40e894618295 100755 (executable)
@@ -1581,13 +1581,16 @@ def command_pull():
 def command_inspect_image():
     # type: () -> int
     out, err, ret = call_throws([
-        container_path, 'images', '--format', 'json', args.image])
-    j = json.loads(out)
-    if not j:
-        return -errno.ENOENT
+        container_path, 'inspect',
+        '--format', '{{.Id}}',
+        args.image])
+    if ret:
+        return errno.ENOENT
+    image_id = normalize_container_id(out.strip())
+    ver = CephContainer(args.image, 'ceph', ['--version']).run()
     r = {
-        'image_id': normalize_container_id(j[0].get('id')),
-        'ceph_version': CephContainer(args.image, 'ceph', ['--version']).run(),
+        'image_id': image_id,
+        'ceph_version': ver,
     }
     print(json.dumps(r, indent=4, sort_keys=True))
     return 0