Skip to content

Commit

Permalink
Azure: Cleanup image definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Mar 12, 2024
1 parent bce77d4 commit 89f6845
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ocw/lib/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ def cleanup_gallery_img_versions(self) -> None:
self.compute_mgmt_client().gallery_image_versions.begin_delete(
self.__resource_group, gallery.name, image.name, version.name
)
properties = self.get_resource_properties(image.id)
if self.is_outdated(parse(properties['publishingProfile']['publishedDate'])):
if self.dry_run:
self.log_info(f"Deletion of image {gallery.name}/{image.name} skipped due to dry run mode")
else:
self.log_info(f"Delete image '{gallery.name}/{image.name}'")
self.compute_mgmt_client().gallery_images.begin_delete(
self.__resource_group, gallery.name, image.name
)

def get_img_versions_count(self) -> int:
self.log_dbg("Call get_img_versions_count")
Expand Down

0 comments on commit 89f6845

Please sign in to comment.