0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 18:23:58 +01:00

Add a check to SQLite port DB script to ensure that the sqlite database passed to the script exists before trying to port from it (#15306)

This commit is contained in:
Shay 2023-03-22 08:36:42 -07:00 committed by GitHub
parent 4b8c9c340c
commit 7f02fafa28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

2
changelog.d/15306.bugfix Normal file
View file

@ -0,0 +1,2 @@
Add a check to [SQLite port_db script](https://matrix-org.github.io/synapse/latest/postgres.html#porting-from-sqlite)
to ensure that the sqlite database passed to the script exists before trying to port from it.

View file

@ -18,6 +18,7 @@
import argparse import argparse
import curses import curses
import logging import logging
import os
import sys import sys
import time import time
import traceback import traceback
@ -1326,6 +1327,13 @@ def main() -> None:
filename="port-synapse.log" if args.curses else None, filename="port-synapse.log" if args.curses else None,
) )
if not os.path.isfile(args.sqlite_database):
sys.stderr.write(
"The sqlite database you specified does not exist, please check that you have the"
"correct path."
)
sys.exit(1)
sqlite_config = { sqlite_config = {
"name": "sqlite3", "name": "sqlite3",
"args": { "args": {