From 089df283338053ebb03bc6fe7c50224a240d3e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 11 Mar 2015 16:17:12 +0100 Subject: [PATCH] Bug #3672: Set fixed backup file names (cherry picked from commit a19db618332a311ba34639c5664bb7b08621fff4) --- src/onedb/onedb.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/onedb/onedb.rb b/src/onedb/onedb.rb index 00cbd444a4..0ea5c1a84c 100644 --- a/src/onedb/onedb.rb +++ b/src/onedb/onedb.rb @@ -69,8 +69,6 @@ class OneDB end def backup(bck_file, ops, backend=@backend) - bck_file = backend.bck_file if bck_file.nil? - if !ops[:force] && File.exists?(bck_file) raise "File #{bck_file} exists, backup aborted. Use -f " << "to overwrite." @@ -81,8 +79,6 @@ class OneDB end def restore(bck_file, ops, backend=@backend) - bck_file = backend.bck_file if bck_file.nil? - if !File.exists?(bck_file) raise "File #{bck_file} doesn't exist, backup restoration aborted." end @@ -143,6 +139,8 @@ class OneDB puts "" end + ops[:backup] = @backend.bck_file if ops[:backup].nil? + backup(ops[:backup], ops) begin @@ -265,6 +263,8 @@ class OneDB @backend.check_db_version() + ops[:backup] = @backend.bck_file if ops[:backup].nil? + # FSCK will be executed, make DB backup backup(ops[:backup], ops) @@ -409,6 +409,9 @@ is preserved. merge_vdcs = input == "Y" + ops[:backup] = @backend.bck_file if ops[:backup].nil? + ops[:"slave-backup"] = slave_backend.bck_file if ops[:"slave-backup"].nil? + # Import will be executed, make DB backup backup(ops[:backup], ops) backup(ops[:"slave-backup"], ops, slave_backend)