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())
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'])