From 373ca99f834ea5eef229fed2d74b13e3d69a7f42 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 6 Feb 2020 09:18:13 -0600 Subject: [PATCH] cephadm: fix inspect-image 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 --- src/cephadm/cephadm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 01478d2768502..ea1012f557a21 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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 -- 2.39.5