From d7d1548e7c07369247571a939b0c1838f1c2ee75 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 2 Dec 2015 12:51:23 +0000 Subject: Catch situations where no files are matched during restore. --- bin/byteback-receive | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/byteback-receive b/bin/byteback-receive index e5be576..c80068b 100755 --- a/bin/byteback-receive +++ b/bin/byteback-receive @@ -59,10 +59,15 @@ if (ARGV[0] == 'byteback-restore') # ownership at the restorers end. args << "--exclude=." + # + # Search for certain files + # DANGER the args might be too long if lots of files are returned. + # + paths = Byteback::Restore.decode_args(ARGV) restore = Byteback::Restore.new(byteback_root) restore.snapshot = snapshot if snapshot - restore.find(Byteback::Restore.decode_args(ARGV)) + restore.find(paths, :all => all) Dir.chdir(byteback_host) @@ -70,7 +75,16 @@ if (ARGV[0] == 'byteback-restore') args << File.join(".", r.snapshot, r.path) end - info(args.join(" ")) + if restore.results.empty? + STDERR.puts "** Sorry. There were no files matching:" + STDERR.puts "--> "+paths.join("\n--> ") + exit 1 + end + + STDERR.puts "Restoring:" + STDERR.puts restore.list + STDERR.puts(args.join(" ")) if verbose + exec(*args) elsif ARGV[0] == 'rsync' -- cgit v1.2.1