def removeImages(self, imgList):
"""
Attempt to remove image metadata from the mongo database
:param imgList: a list of docker image names
:type imgList: a list of strings
"""
try:
for img in imgList:
hash = DockerImage.getHashKey(img)
imageData = self._load(hash)
super(DockerImageModel, self).remove(imageData.getRawData())
except Exception as err:
if isinstance(err, DockerImageNotFoundError):
logger.exception('Image %r does not exist', img)
raise DockerImageNotFoundError(
'The image %s with hash %s does not exist '
'in the database' % (img, hash), img)
else:
logger.exception('Could not remove image %r', img)
raise DockerImageError(
'Could not delete the image data from the database '
'invalid image: ' + img + ' ' + str(err), img)
# TODO validate the xml of each cli
评论列表
文章目录