(feature) Add optional verbose rsync output for manual backups
Expose a verbose rsync output option in the Django manual backup form and store the selected value with the queued run request. Propagate the option through the worker, direct management command, and rsync command builder so real backups can emit itemized changes, file-list progress, and stats when requested. Dry-runs continue to use verbose output by default and report that consistently in requested options. Cover the queue, worker, view, and rsync command behavior with focused tests.
This commit is contained in:
@@ -18,6 +18,7 @@ class Command(BaseCommand):
|
||||
parser.add_argument("host", help="Host to back up")
|
||||
parser.add_argument("--prefix", default=settings.POBSYNC_HOME, help="Pobsync home directory")
|
||||
parser.add_argument("--dry-run", action="store_true", help="Run rsync --dry-run")
|
||||
parser.add_argument("--verbose-rsync", action="store_true", help="Write itemized rsync output to the run log")
|
||||
parser.add_argument("--prune", action="store_true", help="Apply retention after a successful run")
|
||||
parser.add_argument("--prune-max-delete", type=int, default=10)
|
||||
parser.add_argument("--prune-protect-bases", action="store_true")
|
||||
@@ -35,11 +36,21 @@ class Command(BaseCommand):
|
||||
host=host,
|
||||
run_type=BackupRun.RunType.MANUAL if options["manual"] else BackupRun.RunType.SCHEDULED,
|
||||
status=BackupRun.Status.RUNNING,
|
||||
result={
|
||||
"requested": {
|
||||
"dry_run": bool(options["dry_run"]),
|
||||
"verbose_output": bool(options["dry_run"] or options["verbose_rsync"]),
|
||||
"prune": bool(options["prune"]),
|
||||
"prune_max_delete": int(options["prune_max_delete"]),
|
||||
"prune_protect_bases": bool(options["prune_protect_bases"]),
|
||||
}
|
||||
},
|
||||
)
|
||||
execute_backup_run(
|
||||
run=run,
|
||||
prefix=paths.home,
|
||||
dry_run=bool(options["dry_run"]),
|
||||
verbose_output=bool(options["dry_run"] or options["verbose_rsync"]),
|
||||
prune=bool(options["prune"]),
|
||||
prune_max_delete=int(options["prune_max_delete"]),
|
||||
prune_protect_bases=bool(options["prune_protect_bases"]),
|
||||
|
||||
@@ -44,6 +44,7 @@ class Command(BaseCommand):
|
||||
run=run,
|
||||
prefix=prefix,
|
||||
dry_run=bool(options.get("dry_run", False)),
|
||||
verbose_output=bool(options.get("verbose_output", False)),
|
||||
prune=bool(options.get("prune", False)),
|
||||
prune_max_delete=int(options.get("prune_max_delete", 10)),
|
||||
prune_protect_bases=bool(options.get("prune_protect_bases", False)),
|
||||
|
||||
Reference in New Issue
Block a user