Skip to content

Image cleanup broken after failed import #876

@osfrickler

Description

@osfrickler

When an image import (upload) fails, the properties for the image have not yet been set when the manager tries to clean up the image, leading to a traceback like

│ /usr/local/lib/python3.12/site-packages/openstack_image_manager/main.py:1015 in manage_outdated_images                                                       │                                                                                                                 
│                                                                                                                                                              │                                                                                                                 
│   1012 │   │   │   logger.info(f"Processing image '{image}' (removal candidate)")                                                                            │                                                                                                                 
│   1013 │   │   │                                                                                                                                             │                                                                                                                 
│   1014 │   │   │   cloud_image = cloud_images[image]                                                                                                         │                                                                                                                 
│ ❱ 1015 │   │   │   image_name = cloud_image.properties["image_description"]                                                                                  │                                                                                                                 
│   1016 │   │   │                                                                                                                                             │                                                                                                                 
│   1017 │   │   │   if image_name not in images:                                                                                                              │                                                                                                                 
│   1018 │   │   │   │   logger.warning(                                                                                                                       │                                                                                                                 
│                                                                                                                                                              │
...
KeyError: 'image_description'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions