Armada image not found by script 76
This change fixes the removal of Armada images from registry. Initially it was thought that it would only have the airshipt/armada image, but there is also starlingx/armada-image. To resolve this, the starlingx/armada-image key was added to the images to be deleted. Test Plan: PASS Build pkgs and build image PASS Upgrade SX stx-8 -> master PASS When the 76-remove-armada-if-unused.py script is run no error appears and at the end of activation no Armada image is found. Closes-Bug: 2048400 Change-Id: I91ed6a2f8bd0478d845a68716ea6e19b978c47f9 Signed-off-by: David Bastos <david.barbosabastos@windriver.com>
This commit is contained in:
parent
77f2c9ce3d
commit
58c8f8ced6
|
@ -308,33 +308,39 @@ def remove_docker_images():
|
|||
return False
|
||||
|
||||
client = CgtsClient()
|
||||
armada_image = None
|
||||
tiller_image = None
|
||||
armada_images = []
|
||||
|
||||
# Get image names
|
||||
filter_out_untagged = False
|
||||
image_list = client.sysinv.registry_image.list(int(filter_out_untagged))
|
||||
if not image_list:
|
||||
LOG.warning("Failed to remove armada docker image.")
|
||||
LOG.warning("No images were returned from the image registry."
|
||||
"Aborting image cleanup")
|
||||
return False
|
||||
|
||||
for image in image_list:
|
||||
if "airshipit/armada" in image.name:
|
||||
armada_image = image.name
|
||||
elif "helm/tiller" in image.name:
|
||||
tiller_image = image.name
|
||||
if any(x in image.name for x in (
|
||||
'airshipit/armada',
|
||||
'starlingx/armada-image',
|
||||
'helm/tiller')
|
||||
):
|
||||
armada_images.append(image.name)
|
||||
|
||||
if not armada_image and not tiller_image:
|
||||
LOG.debug("Could not find armada and tiller images in "
|
||||
"docker registry.")
|
||||
return True
|
||||
if armada_images:
|
||||
deletion_success = True
|
||||
for image in armada_images:
|
||||
LOG.info("Deleting image: %s" % image)
|
||||
|
||||
# Delete images
|
||||
if delete_images(armada_image) and delete_images(tiller_image):
|
||||
if not delete_images(image):
|
||||
LOG.error("Could not delete image: %s. Continuing..." % image)
|
||||
deletion_success = False
|
||||
|
||||
LOG.info("Running image garbage collect.")
|
||||
client.sysinv.registry_image.garbage_collect()
|
||||
return deletion_success
|
||||
else:
|
||||
return False
|
||||
|
||||
return True
|
||||
LOG.info("No armada/tiller images are present in the registry.")
|
||||
return True
|
||||
|
||||
|
||||
def drop_helm_v2_database():
|
||||
|
|
Loading…
Reference in New Issue