From 174794ccb546fab86b7823c21ceb3679e9a5080f Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 14 Aug 2017 14:14:16 +0200 Subject: [PATCH] fail with info message if recovery is asked with source path --- backup.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backup.py b/backup.py index 06d541d..0351300 100644 --- a/backup.py +++ b/backup.py @@ -24,6 +24,7 @@ import os import re import random import shutil +import sys from datetime import datetime from functools import partial @@ -146,9 +147,11 @@ if __name__ == "__main__": else: deltatar.restore_backup(args.targetpath, backup_tar_path=args.sourcepath) elif args.recover: + if args.sourcepath is not None: + print("Disaster recovery conflicts with --sourcepath; please supply" + " an\nindex file (--indexes).", file=sys.stderr) failed = deltatar.recover_backup(args.targetpath, - backup_indexes_paths=args.indexes, - backup_tar_path=args.sourcepath) + backup_indexes_paths=args.indexes) if len (failed) > 0: logger = logging.getLogger('deltatar.DeltaTar') print ("%d files could not be restored:" % len (failed)) @@ -158,7 +161,6 @@ if __name__ == "__main__": elif args.equals: check_equal_dirs(os.path.abspath(args.sourcepath), os.path.abspath(args.targetpath), deltatar) else: - import sys print("Nothing to do.\nPlease specify one of --full, --diff, --list-files, " "--restore, --equals.\n", file=sys.stderr) parser.print_help(file=sys.stderr) -- 1.7.1