From e2615e83e99ea8a154520fd0acb00d775a234b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Fri, 8 Jun 2018 10:45:22 +0200 Subject: [PATCH] Do not explode on empty containers list In the case the containers list was empty or non existent, container-check would explode and produce a traceback. This is for example visible at [1]. This commit makes container-check more robust about the input data. [1] http://logs.openstack.org/06/572806/1/experimental/tripleo-ci-centos-7-scenario009-multinode-oooq/a88c395/logs/undercloud/home/zuul/overcloud_prep_containers.log.txt.gz Change-Id: I5639cd2b0b32b8f1261064ee178193f0c589f233 --- scripts/container-update.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/container-update.py b/scripts/container-update.py index 38a900a9f..448f68d96 100755 --- a/scripts/container-update.py +++ b/scripts/container-update.py @@ -179,15 +179,13 @@ def get_available_rpms(): def get_container_list(container_file): + container_list = [] with open(container_file) as cf: - data = yaml.safe_load(cf.read()).get('container_images') - if not data: - return None - container_list = [] + data = yaml.safe_load(cf.read()).get('container_images', []) for image_info in data: print('image_info: %s' % image_info) container_list.append(image_info['imagename']) - return container_list + return container_list if __name__ == '__main__':