mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Add error logging for database connection failures in scheduler scripts
This commit is contained in:
parent
ee708e44f7
commit
159c9475f3
2 changed files with 8 additions and 2 deletions
|
|
@ -110,6 +110,8 @@ with db.sql_engine.connect() as conn:
|
|||
print(next(result)[0])
|
||||
except BaseException as e:
|
||||
if 'doesn\'t exist' not in str(e) and 'no such table' not in str(e) and 'relation \"bw_metadata\" does not exist' not in str(e):
|
||||
with open('/var/tmp/bunkerweb/database_error', 'w') as file:
|
||||
file.write(str(e))
|
||||
print('none')
|
||||
else:
|
||||
print('${installed_version}')
|
||||
|
|
@ -122,7 +124,8 @@ EOL
|
|||
rm -f /tmp/version_check.py
|
||||
|
||||
if [ "$current_version" == "none" ]; then
|
||||
log "SYSTEMCTL" "❌" "Failed to retrieve database version"
|
||||
log "SYSTEMCTL" "❌" "Failed to retrieve database version: $(cat /var/tmp/bunkerweb/database_error)"
|
||||
rm -f /var/tmp/bunkerweb/database_error
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ with db.sql_engine.connect() as conn:
|
|||
print(next(result)[0])
|
||||
except BaseException as e:
|
||||
if 'doesn\'t exist' not in str(e) and 'no such table' not in str(e) and 'relation \"bw_metadata\" does not exist' not in str(e):
|
||||
with open('/var/tmp/bunkerweb/database_error', 'w') as file:
|
||||
file.write(str(e))
|
||||
print('none')
|
||||
else:
|
||||
print('${installed_version}')
|
||||
|
|
@ -86,7 +88,8 @@ with open('/var/tmp/bunkerweb/database_uri', 'w') as file:
|
|||
")
|
||||
|
||||
if [ "$current_version" == "none" ]; then
|
||||
log "ENTRYPOINT" "❌" "Failed to retrieve database version"
|
||||
log "ENTRYPOINT" "❌" "Failed to retrieve database version: $(cat /var/tmp/bunkerweb/database_error)"
|
||||
rm -f /var/tmp/bunkerweb/database_error
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue