Skip to content

Commit

Permalink
Fix snapshot_exists arguments, add extra option to condition (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchclarkebase2 authored Jan 15, 2025
1 parent 9367818 commit 6917333
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shelvery/rds_cluster_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ def copy_backup_to_region(self, backup_id: str, region: str) -> str:
)
return backup_id

def snapshot_exists(client, backup_id):
def snapshot_exists(self, client, backup_id):
try:
response = client.describe_db_cluster_snapshots(DBClusterSnapshotIdentifier=backup_id)
snapshots = response.get('DBClusterSnapshots', [])
return bool(snapshots)
except ClientError as e:
if e.response['Error']['Code'] == 'DBClusterSnapshotNotFound':
if e.response['Error']['Code'] == 'DBClusterSnapshotNotFound' or e.response['Error']['Code'] == 'DBClusterSnapshotNotFoundFault':
return False
else:
print(e.response['Error']['Code'])
Expand Down

0 comments on commit 6917333

Please sign in to comment.