fix: resolve per-torrent qb save paths
This commit is contained in:
@@ -134,7 +134,7 @@ from pathlib import Path
|
||||
from archive_clients.config import ClientConfig
|
||||
config=ClientConfig.load(Path(sys.argv[1]))
|
||||
value={"shared_token_file":str(config.shared_token_file)}
|
||||
value["qbittorrent"]={"api_root":str(config.qbittorrent.api_root),"local_root":str(config.qbittorrent.local_root),"password_file":str(config.qbittorrent.password_file)}
|
||||
value["qbittorrent"]={"api_root":str(config.qbittorrent.api_root),"local_root":str(config.qbittorrent.local_root),"password_file":str(config.qbittorrent.password_file),"local_path_overrides":{str(api):str(local) for api,local in config.qbittorrent.local_path_overrides}}
|
||||
value["syncthing"]={"api_root":str(config.syncthing.api_root),"local_root":str(config.syncthing.local_root),"api_key_file":str(config.syncthing.api_key_file),"local_path_overrides":{str(api):str(local) for api,local in config.syncthing.local_path_overrides}}
|
||||
print(json.dumps(value,sort_keys=True))'''
|
||||
result = subprocess.run(
|
||||
@@ -174,6 +174,26 @@ raise SystemExit(0 if all(p.state == 1 for p in probes) else 1)'''
|
||||
print(result.stdout.strip())
|
||||
|
||||
|
||||
def require_qb_override_mappings(
|
||||
client: dict[str, Any], qbittorrent: dict[str, Any], qb: dict[str, Any],
|
||||
) -> None:
|
||||
"""Prove every explicit qB API/local override sees the same host bytes."""
|
||||
|
||||
overrides = qb.get("local_path_overrides", {})
|
||||
if not isinstance(overrides, dict):
|
||||
raise CheckFailure("qbittorrent.local_path_overrides must be a table")
|
||||
for api_path, local_path in overrides.items():
|
||||
if not isinstance(api_path, str) or not isinstance(local_path, str):
|
||||
raise CheckFailure(
|
||||
"qbittorrent.local_path_overrides entries are invalid"
|
||||
)
|
||||
require_same_path(
|
||||
f"qBittorrent override {api_path}/local mapping",
|
||||
map_path(qbittorrent, api_path),
|
||||
map_path(client, local_path),
|
||||
)
|
||||
|
||||
|
||||
def run_hardlink_probe(
|
||||
container: str, qb_root: str, route_root: str, user: str | None = None,
|
||||
) -> None:
|
||||
@@ -298,6 +318,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
syncthing_route, client_route,
|
||||
)
|
||||
require_same_path("qBittorrent api_root/local_root", qb_api, client_qb)
|
||||
require_qb_override_mappings(client, qbittorrent, qb)
|
||||
if client_qb.destination != client_route.destination:
|
||||
raise CheckFailure(
|
||||
"qBittorrent and future route roots use separate client bind "
|
||||
|
||||
Reference in New Issue
Block a user