imgadm module should deal with invalid images better

This commit is contained in:
Jorge Schrauwen 2019-01-29 11:35:10 +01:00 committed by Ch3LL
parent 1ea6f4b18b
commit e4971fcabd
No known key found for this signature in database
GPG key ID: 132B55A7C13EFA73

View file

@ -56,7 +56,7 @@ def _parse_image_meta(image=None, detail=False):
if image and 'Error' in image:
ret = image
elif image:
elif image and 'manifest' in image:
name = image['manifest']['name']
version = image['manifest']['version']
os = image['manifest']['os']
@ -164,6 +164,8 @@ def docker_to_uuid(uuid):
if _is_docker_uuid(uuid):
images = list_installed(verbose=True)
for image_uuid in images:
if 'name' not in images[image_uuid]:
continue
if images[image_uuid]['name'] == uuid:
return image_uuid
return None