Skip to content

Commit

Permalink
Implement pcw_ignore for cleanup_images in gce
Browse files Browse the repository at this point in the history
  • Loading branch information
pdostal committed Jul 16, 2024
1 parent d051d0c commit b7162f5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ocw/lib/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,14 @@ def cleanup_images(self) -> None:
self.log_dbg(f"{len(images)} images found")
for image in images:
if self.is_outdated(parse(image["creationTimestamp"]).astimezone(timezone.utc)):
self._delete_resource(
self.compute_client().images, image["name"], project=self.project, image=image["name"]
)
labels = image.get('labels', [])
pcw_ignore_tag = 'pcw_ignore' in labels
if pcw_ignore_tag:
self.log_dbg(f"Ignoring {image['name']} due to 'pcw_ignore' label set to '1'")
else:
self._delete_resource(
self.compute_client().images, image["name"], project=self.project, image=image["name"]
)

def cleanup_firewalls(self) -> None:
self.log_dbg("Firewalls cleanup")
Expand Down

0 comments on commit b7162f5

Please sign in to comment.