mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-22 21:43:07 +01:00
migrate_to_persist_sqlite.py: Fix db dump tool name
Closes #3473. Thanks to Stuart Henderson
This commit is contained in:
parent
87903e29b0
commit
51ab9cabec
|
|
@ -295,22 +295,22 @@ class SQLite3Persistence:
|
|||
# Migration
|
||||
|
||||
|
||||
def find_mosquitto_dump_tool() -> str:
|
||||
mosquitto_dump_tool = shutil.which("mosquitto_dump_tool")
|
||||
if mosquitto_dump_tool is None:
|
||||
def find_mosquitto_db_dump() -> str:
|
||||
mosquitto_db_dump = shutil.which("mosquitto_db_dump")
|
||||
if mosquitto_db_dump is None:
|
||||
raise RuntimeError(
|
||||
'Could not find mosquitto_dump_tool. Provide the path via the "--dump-tool" argument '
|
||||
'Could not find mosquitto_db_dump. Provide the path via the "--dump-tool" argument '
|
||||
"or make sure the executable is contained in your system's path."
|
||||
)
|
||||
return mosquitto_dump_tool
|
||||
return mosquitto_db_dump
|
||||
|
||||
|
||||
def dump_mosquitto_db_to_json(
|
||||
mosquitto_dump_tool: str, persistence_db_path: Path
|
||||
mosquitto_db_dump: str, persistence_db_path: Path
|
||||
) -> str:
|
||||
return subprocess.check_output(
|
||||
[
|
||||
mosquitto_dump_tool,
|
||||
mosquitto_db_dump,
|
||||
"--json",
|
||||
str(persistence_db_path),
|
||||
]
|
||||
|
|
@ -351,8 +351,8 @@ def main():
|
|||
|
||||
args = parser.parse_args()
|
||||
persistence_db_path = Path(args.persistence_db)
|
||||
mosquitto_dump_tool = (
|
||||
args.dump_tool if args.dump_tool else find_mosquitto_dump_tool()
|
||||
mosquitto_db_dump = (
|
||||
args.dump_tool if args.dump_tool else find_mosquitto_db_dump()
|
||||
)
|
||||
|
||||
if args.conf is not None:
|
||||
|
|
@ -377,7 +377,7 @@ def main():
|
|||
|
||||
# Dump Snapshot persistence and parse JSON
|
||||
snapshot_persistence = SnapshotPersistence(
|
||||
dump_mosquitto_db_to_json(mosquitto_dump_tool, persistence_db_path)
|
||||
dump_mosquitto_db_to_json(mosquitto_db_dump, persistence_db_path)
|
||||
)
|
||||
|
||||
# Migrate Snapshot persistence and write SQLite3 file
|
||||
|
|
|
|||
Loading…
Reference in a new issue