Skip to content

Commit

Permalink
Merge pull request #423 from linguini-dev/fix/gce-disks-ignore
Browse files Browse the repository at this point in the history
Adds logic to check for pcw_ignore flag
  • Loading branch information
asmorodskyi authored Jan 29, 2025
2 parents c37879e + d871823 commit fd0627f
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 @@ -177,9 +177,14 @@ def cleanup_disks(self) -> None:
self.log_dbg(f"{len(disks)} disks found")
for disk in disks:
if self.is_outdated(parse(disk["creationTimestamp"]).astimezone(timezone.utc)):
self._delete_resource(
self.compute_client().disks, disk["name"], project=self.project, zone=zone, disk=disk["name"]
)
labels = disk.get('labels', [])
pcw_ignore_tag = 'pcw_ignore' in labels
if pcw_ignore_tag:
self.log_dbg(f"Ignoring {disk['name']} due to 'pcw_ignore' label set to '1'")
else:
self._delete_resource(
self.compute_client().disks, disk["name"], project=self.project, zone=zone, disk=disk["name"]
)

def cleanup_images(self) -> None:
self.log_dbg("Images cleanup")
Expand Down

0 comments on commit fd0627f

Please sign in to comment.