Loading check_s3_bucket/__init__.py +5 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,10 @@ def get_file_list(conn, bucket, prefix=""): # I'm not concerened with the limitation of number of keys in the # response as the buckets have a lifecycle rule enabled and files are # automatically moved of the bucket. files = conn.list_objects_v2(Bucket=bucket, Prefix=prefix)["Contents"] response = conn.list_objects_v2(Bucket=bucket, Prefix=prefix) if "Contents" not in response: return [] files = response["Contents"] files.sort(key=lambda x: x["LastModified"], reverse=True) files = files[:2] for file in files: Loading Loading @@ -96,7 +99,7 @@ def main(): exit(3) if not files: print("Not matching files in bucket.") print("No matching files in bucket.") exit(2) # Calculate the age of the latest file and if it's in the thresholds set. Loading Loading
check_s3_bucket/__init__.py +5 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,10 @@ def get_file_list(conn, bucket, prefix=""): # I'm not concerened with the limitation of number of keys in the # response as the buckets have a lifecycle rule enabled and files are # automatically moved of the bucket. files = conn.list_objects_v2(Bucket=bucket, Prefix=prefix)["Contents"] response = conn.list_objects_v2(Bucket=bucket, Prefix=prefix) if "Contents" not in response: return [] files = response["Contents"] files.sort(key=lambda x: x["LastModified"], reverse=True) files = files[:2] for file in files: Loading Loading @@ -96,7 +99,7 @@ def main(): exit(3) if not files: print("Not matching files in bucket.") print("No matching files in bucket.") exit(2) # Calculate the age of the latest file and if it's in the thresholds set. Loading