From 0457af23eb8a73f8418dc10b8a5dec4f95c06da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BCchse?= Date: Wed, 23 Aug 2023 14:29:41 +0200 Subject: [PATCH] Prescribe image_source prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Büchse --- Tests/iaas/scs-0104-v1-images.yaml | 25 +++++++++++------- .../iaas/standard-images/images-openstack.py | 26 +++++++------------ 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Tests/iaas/scs-0104-v1-images.yaml b/Tests/iaas/scs-0104-v1-images.yaml index 288cb04db..4a95b1f0f 100644 --- a/Tests/iaas/scs-0104-v1-images.yaml +++ b/Tests/iaas/scs-0104-v1-images.yaml @@ -1,10 +1,15 @@ -image_groups: - - status: mandatory - list: - - "Ubuntu 22.04" - - "Ubuntu 20.04" - - "Debian 12" - - status: recommended - list: - - "Debian 11" - - "Fedora 38" +images: +- name: "Ubuntu 22.04" + source: https://cloud-images.ubuntu.com/releases/jammy/ + status: mandatory +- name: "Kubernetes CAPI 1.27.3" + source: https://minio.services.osism.tech/openstack-k8s-capi-images/ubuntu-2204-kube-v1.27/ubuntu-2204-kube-v1.27.3.qcow2 + status: recommended +- name: "Ubuntu 20.04" + source: https://cloud-images.ubuntu.com/releases/focal/ +- name: "Debian 12" + source: https://cloud.debian.org/images/cloud/bookworm/ +- name: "Debian 11" + source: https://cloud.debian.org/images/cloud/bullseye/ +- name: "Debian 10" + source: https://cloud.debian.org/images/cloud/buster/ diff --git a/Tests/iaas/standard-images/images-openstack.py b/Tests/iaas/standard-images/images-openstack.py index 42f5e7f1e..7779c51f8 100755 --- a/Tests/iaas/standard-images/images-openstack.py +++ b/Tests/iaas/standard-images/images-openstack.py @@ -94,26 +94,15 @@ def main(argv): logger.debug("Exception info", exc_info=True) return 1 - if 'image_groups' not in image_data: - logger.critical("Image definition missing 'image_groups' field") + if 'images' not in image_data: + logger.critical("Image definition missing 'images' field") return 1 - # compute union of all image groups, copying group info (mainly "status") to each image - image_specs = [] - for image_group in image_data['image_groups']: - group_info = dict(image_group) - group_info.pop('list') - missing = {'status'} - set(group_info) - if missing: - logging.critical(f"Image group missing attributes: {', '.join(missing)}") - return 1 - for image_name in image_group['list']: - image_specs.append({"_group": group_info, "name": image_name}) - + image_specs = image_data['images'] try: logger.debug(f"Fetching image list from cloud '{cloud}'") with openstack.connect(cloud=cloud, timeout=32) as conn: - present_images = conn.list_images() + present_images = conn.list_images(show_all=True) by_name = { image.name: image for image in present_images @@ -123,10 +112,13 @@ def main(argv): for image_spec in image_specs: image = by_name.get(image_spec['name']) if not image: - status = image_spec['_group']['status'] - level = {"mandatory": logging.ERROR}.get(status, logging.INFO) + status = image_spec.get('status', 'optional') + level = {"mandatory": logging.ERROR, "recommended": logging.INFO}.get(status, logging.DEBUG) logger.log(level, f"Missing {status} image '{image_spec['name']}'") continue + img_source = image.properties['image_source'] + if not img_source.startswith(image_spec['source']): + logger.error(f"Image '{image_spec['name']}' source mismatch: {image_spec['source']} != {img_source} {image.properties}") except BaseException as e: logger.critical(f"{e!r}") logger.debug("Exception info", exc_info=True)