Use full restic JSON output
This commit is contained in:
@@ -9,7 +9,7 @@ from keyboards import backup_kb
|
|||||||
from lock_utils import acquire_lock, release_lock
|
from lock_utils import acquire_lock, release_lock
|
||||||
from services.queue import enqueue, format_status, format_details
|
from services.queue import enqueue, format_status, format_details
|
||||||
from services.backup import backup_badge, restore_help
|
from services.backup import backup_badge, restore_help
|
||||||
from services.runner import run_cmd
|
from services.runner import run_cmd, run_cmd_full
|
||||||
|
|
||||||
|
|
||||||
def _parse_systemctl_kv(raw: str) -> dict[str, str]:
|
def _parse_systemctl_kv(raw: str) -> dict[str, str]:
|
||||||
@@ -80,7 +80,7 @@ async def cmd_repo_stats(msg: Message):
|
|||||||
await msg.answer("⏳ Loading repo stats…", reply_markup=backup_kb)
|
await msg.answer("⏳ Loading repo stats…", reply_markup=backup_kb)
|
||||||
|
|
||||||
# --- restore-size stats ---
|
# --- restore-size stats ---
|
||||||
rc1, raw1 = await run_cmd(
|
rc1, raw1 = await run_cmd_full(
|
||||||
["restic", "stats", "--json"],
|
["restic", "stats", "--json"],
|
||||||
use_restic_env=True,
|
use_restic_env=True,
|
||||||
timeout=30
|
timeout=30
|
||||||
@@ -96,7 +96,7 @@ async def cmd_repo_stats(msg: Message):
|
|||||||
|
|
||||||
|
|
||||||
# --- raw-data stats ---
|
# --- raw-data stats ---
|
||||||
rc2, raw2 = await run_cmd(
|
rc2, raw2 = await run_cmd_full(
|
||||||
["restic", "stats", "--json", "--mode", "raw-data"],
|
["restic", "stats", "--json", "--mode", "raw-data"],
|
||||||
use_restic_env=True,
|
use_restic_env=True,
|
||||||
timeout=30
|
timeout=30
|
||||||
@@ -112,7 +112,7 @@ async def cmd_repo_stats(msg: Message):
|
|||||||
|
|
||||||
|
|
||||||
# --- snapshots count ---
|
# --- snapshots count ---
|
||||||
rc3, raw_snaps = await run_cmd(
|
rc3, raw_snaps = await run_cmd_full(
|
||||||
["restic", "snapshots", "--json"],
|
["restic", "snapshots", "--json"],
|
||||||
use_restic_env=True,
|
use_restic_env=True,
|
||||||
timeout=20
|
timeout=20
|
||||||
@@ -141,7 +141,7 @@ async def cmd_backup_status(msg: Message):
|
|||||||
await msg.answer("⏳ Loading snapshots…", reply_markup=backup_kb)
|
await msg.answer("⏳ Loading snapshots…", reply_markup=backup_kb)
|
||||||
|
|
||||||
async def worker():
|
async def worker():
|
||||||
rc, raw = await run_cmd(
|
rc, raw = await run_cmd_full(
|
||||||
["restic", "snapshots", "--json"],
|
["restic", "snapshots", "--json"],
|
||||||
use_restic_env=True,
|
use_restic_env=True,
|
||||||
timeout=30
|
timeout=30
|
||||||
@@ -213,7 +213,7 @@ async def cmd_last_snapshot(msg: Message):
|
|||||||
await msg.answer("⏳ Loading last snapshot…", reply_markup=backup_kb)
|
await msg.answer("⏳ Loading last snapshot…", reply_markup=backup_kb)
|
||||||
|
|
||||||
async def worker():
|
async def worker():
|
||||||
rc, raw = await run_cmd(
|
rc, raw = await run_cmd_full(
|
||||||
["restic", "snapshots", "--json"],
|
["restic", "snapshots", "--json"],
|
||||||
use_restic_env=True,
|
use_restic_env=True,
|
||||||
timeout=20
|
timeout=20
|
||||||
@@ -235,7 +235,7 @@ async def cmd_last_snapshot(msg: Message):
|
|||||||
t = datetime.fromisoformat(s["time"].replace("Z", "+00:00"))
|
t = datetime.fromisoformat(s["time"].replace("Z", "+00:00"))
|
||||||
short_id = s["short_id"]
|
short_id = s["short_id"]
|
||||||
|
|
||||||
rc2, raw2 = await run_cmd(
|
rc2, raw2 = await run_cmd_full(
|
||||||
["restic", "stats", short_id, "--json"],
|
["restic", "stats", short_id, "--json"],
|
||||||
use_restic_env=True,
|
use_restic_env=True,
|
||||||
timeout=20
|
timeout=20
|
||||||
|
|||||||
Reference in New Issue
Block a user