Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds logic to check for pcw_ignore flag #423

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading