From: Sage Weil Date: Wed, 22 Jan 2020 22:46:05 +0000 (-0600) Subject: cephadm: fix image_id normalization X-Git-Tag: v15.1.0~92^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3806c5e7f25eac851ae2e7d9c6d65b28693a6c2e;p=ceph.git cephadm: fix image_id normalization Remove sha256: prefix from id (hash), not name. Signed-off-by: Sage Weil --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index c6736972f93..df53bb5364f 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -608,6 +608,16 @@ def generate_password(): return ''.join(random.choice(string.ascii_lowercase + string.digits) for i in range(10)) +def normalize_container_id(i): + # docker adds the sha256: prefix, but AFAICS both + # docker (18.09.7 in bionic at least) and podman + # both always use sha256, so leave off the prefix + # for consistency. + prefix = 'sha256:' + if i.startswith(prefix): + i = i[len(prefix):] + return i + def make_fsid(): # type: () -> str return str(uuid.uuid1()) @@ -2188,13 +2198,7 @@ def list_daemons(detail=True, legacy_dir=None): verbose_on_failure=False) if not code: (container_id, image_name, image_id) = out.strip().split(',') - # docker adds the sha256: prefix, but AFAICS both - # docker (18.09.7 in bionic at least) and podman - # both always use sha256, so leave off the prefix - # for consistency. - prefix = 'sha256:' - if image_name.startswith(prefix): - image_name = image_name[len(prefix):] + image_id = normalize_container_id(image_id) out, err, code = call( [container_path, 'exec', container_id, 'ceph', '-v'])