Fix the image download issue if unknown image ever specified

We have a yaml file which has a section "download_images" stores
the required images. The required images list will be regenerated
when applying application. The current logic is to extend the stored
image list with the newly generated image list which causes the
application apply to always fail if the user ever specifies an
unknown image. The extend should be removed.

Change-Id: I6ee031c7f866ab213e2ef8204c1f829567dcb376
Closes-Bug: 1821344
Signed-off-by: Angie Wang <angie.wang@windriver.com>
This commit is contained in:
Angie Wang 2019-03-27 10:10:32 -04:00
parent a5c6b508b1
commit d1536ac9df
1 changed files with 2 additions and 5 deletions

View File

@ -472,11 +472,8 @@ class AppOperator(object):
# between upload and apply, or between applies. Refresh the
# saved images list.
saved_images_list = self._retrieve_images_list(app.imgfile_abs)
saved_download_images_list = saved_images_list.get("download_images")
combined_images_list = list(saved_download_images_list)
combined_images_list.extend(
self._get_image_tags_by_charts(app.imgfile_abs, app.charts))
images_to_download = list(set(combined_images_list))
saved_download_images_list = list(saved_images_list.get("download_images"))
images_to_download = self._get_image_tags_by_charts(app.imgfile_abs, app.charts)
if set(saved_download_images_list) != set(images_to_download):
saved_images_list.update({"download_images": images_to_download})
with open(app.imgfile_abs, 'wb') as f: