Podman,
check_container_engine,
find_container_engine,
+ normalize_container_id,
parsed_container_cpu_perc,
parsed_container_image_stats,
parsed_container_mem_usage,
for i in range(10))
-def normalize_container_id(i):
- # type: (str) -> str
- # 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())
ctx, image_name, container_path=container_path
)
return _parse_container_image_stats(image_name, out, err, code)
+
+
+def normalize_container_id(i: str) -> str:
+ # 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.
+ # ---
+ # (JJM) This is not a good idea and cephadm should move away from stripping
+ # the hash-type prefix. This is there so that docker/OCI can eventually
+ # move hash types if need be. Removing it breaks hash agility!
+ prefix = 'sha256:'
+ if i.startswith(prefix):
+ i = i[len(prefix) :]
+ return i