Skip to content

Commit

Permalink
Merge pull request #300 from ricardobranco777/ec2_vpc
Browse files Browse the repository at this point in the history
ec2: Handle exception in delete_vpc_subnets
  • Loading branch information
grisu48 authored Aug 21, 2023
2 parents 02aed66 + 185a262 commit bad7f7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ocw/lib/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ def delete_vpc_subnets(self, vpc) -> None:
self.log_info(f'Deletion of {interface} skipped due to dry_run mode')
else:
self.log_info(f'Deleting {interface}')
interface.delete()
try:
interface.delete()
except ClientError as exc:
self.log_err("delete_vpc_subnets: %s", exc)
continue
if self.dry_run:
self.log_info(f'Deletion of {subnet} skipped due to dry_run mode')
else:
Expand Down
2 changes: 1 addition & 1 deletion ocw/lib/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def list_zones(self, region) -> list:
)
return [basename(z) for z in region["zones"]]
except (KeyError, HttpError) as exc:
self.log_dbg("list_zones: %s", exc)
self.log_err("list_zones: %s", exc)
return []

def delete_instance(self, instance_id, zone) -> None:
Expand Down

0 comments on commit bad7f7c

Please sign in to comment.