mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Add backup option to onedb
This commit is contained in:
parent
2d2cf68a80
commit
43c82e4e7b
@ -45,6 +45,14 @@ FORCE={
|
||||
:description => "Forces the backup even if the DB exists"
|
||||
}
|
||||
|
||||
BACKUP={
|
||||
:name => "backup",
|
||||
:short => "-b file",
|
||||
:large => "--backup file",
|
||||
:description => "Use this file to store SQL dump",
|
||||
:format => String
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# SQLite options
|
||||
###############################################################################
|
||||
@ -203,7 +211,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
By default the DB is upgraded to the latest version
|
||||
EOT
|
||||
|
||||
command :upgrade , upgrade_desc, [:version, nil] do
|
||||
command :upgrade , upgrade_desc, [:version, nil], :options=>[FORCE,BACKUP] do
|
||||
helper = OneDB.new(options)
|
||||
helper.upgrade(args[0], options)
|
||||
end
|
||||
|
@ -109,13 +109,7 @@ class OneDB
|
||||
if File.exists?(file) &&
|
||||
(max_version == nil || migrator_version <= max_version)
|
||||
# At least one upgrade will be executed, make DB backup
|
||||
if ops[:backup]
|
||||
bck_file = ops[:backup]
|
||||
else
|
||||
bck_file = @backend.bck_file
|
||||
end
|
||||
|
||||
@backend.backup(bck_file)
|
||||
backup(ops[:backup], ops)
|
||||
end
|
||||
|
||||
while File.exists?(file) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user