Skip to content

Commit 7a69440

Browse files
committed
Fix flake8 errors
Signed-off-by: Anja Strunk <[email protected]>
1 parent 794ae6f commit 7a69440

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

compliance-monitor/monitor.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -731,28 +731,29 @@ async def get_healthz(
731731

732732
# check credentials
733733
if credentials is None:
734-
# no credentials were set
735-
check_db_connection()
734+
# no credentials were set
735+
check_db_connection()
736736
elif credentials.username == settings.hc_user and credentials.password == settings.hc_password:
737-
# healthz user
738-
check_db_connection(authorized=True)
737+
# healthz user
738+
check_db_connection(authorized=True)
739739
else:
740-
# unauthorized user
741-
check_db_connection()
740+
# unauthorized user
741+
check_db_connection()
742742

743743
return {"message": "OK"}
744744

745+
745746
def check_db_connection(authorized: bool = False):
746-
# check database connection
747-
try:
748-
mk_conn(settings=settings)
749-
except psycopg2.OperationalError as e:
750-
if authorized:
751-
# authorized user
752-
raise HTTPException(status_code=500,
753-
detail="Database Connection Error. " + e.args[0].capitalize())
754-
else:
755-
raise HTTPException(status_code=500, detail="Internal Server Error")
747+
# check database connection
748+
try:
749+
mk_conn(settings=settings)
750+
except psycopg2.OperationalError as e:
751+
if authorized:
752+
# authorized user
753+
raise HTTPException(status_code=500,
754+
detail="Database Connection Error. " + e.args[0].capitalize())
755+
else:
756+
raise HTTPException(status_code=500, detail="Internal Server Error")
756757

757758

758759
def pick_filter(results, subject, scope):

0 commit comments

Comments
 (0)