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 curses
import logging
import os
import sys
import time
import traceback
@ -1326,6 +1327,13 @@ def main() -> 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 = {
"name": "sqlite3",
"args": {