File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1789,12 +1789,24 @@ def delete_bucket(self, bucket_name):
1789
1789
1790
1790
s3_buckets = self .get_buckets ()
1791
1791
1792
- # Delete the buckets if they exists
1792
+ # Delete the bucket if its exists
1793
1793
if bucket_name in s3_buckets :
1794
1794
self .s3_client .delete_bucket (Bucket = bucket_name )
1795
1795
log (f'Bucket { bucket_name } deleted\n ' )
1796
+
1797
+ # This is here in case there is a mistake and the S3 buckets are not deleted
1798
+ # This will erase all the froster-unittest* buckets at once
1799
+ elif bucket_name == "froster-unittest" :
1800
+ for bucket in s3_buckets :
1801
+ if bucket .startswith (bucket_name ):
1802
+ try :
1803
+ self .s3_client .delete_bucket (Bucket = bucket )
1804
+ except Exception as e :
1805
+ print (f'Error: { e } ' )
1806
+ continue
1807
+ log (f'\n Bucket { bucket } deleted\n ' )
1796
1808
else :
1797
- log (f'Bucket { bucket_name } not found\n ' )
1809
+ log (f'\n Bucket { bucket_name } not found\n ' )
1798
1810
1799
1811
return True
1800
1812
You can’t perform that action at this time.
0 commit comments