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

Remove logged warnings for maintenance mode check #4396

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions backend/config/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def is_maintenance_on():
Get current status of maintenance mode.
"""

return file_exists(S3_FILENAME)
return file_exists(S3_FILENAME, show_warning=False)


def change_maintenance(enabled):
Expand All @@ -37,7 +37,7 @@ def change_maintenance(enabled):

# turn off.
else:
if file_exists(S3_FILENAME):
if file_exists(S3_FILENAME, show_warning=False):
s3_client.delete_object(
Bucket=settings.AWS_PRIVATE_STORAGE_BUCKET_NAME, Key=S3_FILENAME
)
Expand Down
5 changes: 3 additions & 2 deletions backend/dissemination/file_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_filename(report_id, file_type):
raise Http404()


def file_exists(filename):
def file_exists(filename, show_warning=True):
# this client uses the internal endpoint url because we're making a request to S3 from within the app
s3_client = boto3_client(
service_name="s3",
Expand All @@ -57,7 +57,8 @@ def file_exists(filename):

return True
except ClientError:
logger.warn(f"Unable to locate file {filename} in S3!")
if show_warning:
logger.warn(f"Unable to locate file {filename} in S3!")
return False


Expand Down