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)