Commit ad25ef1f authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

List available backups for restore

parent 377d5c9e
...@@ -108,7 +108,12 @@ module Backup ...@@ -108,7 +108,12 @@ module Backup
$progress.puts "Please make sure that file name ends with #{FILE_NAME_SUFFIX}" $progress.puts "Please make sure that file name ends with #{FILE_NAME_SUFFIX}"
exit 1 exit 1
elsif backup_file_list.many? && ENV["BACKUP"].nil? elsif backup_file_list.many? && ENV["BACKUP"].nil?
$progress.puts 'Found more than one backup, please specify which one you want to restore:' $progress.puts 'Found more than one backup:'
# print list of available backups
backup_file_list.each do |item|
$progress.puts " " + item.gsub("#{FILE_NAME_SUFFIX}", "")
end
$progress.puts 'Please specify which one you want to restore:'
$progress.puts 'rake gitlab:backup:restore BACKUP=timestamp_of_backup' $progress.puts 'rake gitlab:backup:restore BACKUP=timestamp_of_backup'
exit 1 exit 1
end end
......
...@@ -194,6 +194,13 @@ describe Backup::Manager do ...@@ -194,6 +194,13 @@ describe Backup::Manager do
) )
end end
it 'prints the list of available backups' do
expect(progress).to have_received(:puts)
.with(a_string_matching('1451606400_2016_01_01_1.2.3'))
expect(progress).to have_received(:puts)
.with(a_string_matching('1451520000_2015_12_31'))
end
it 'fails the operation and prints an error' do it 'fails the operation and prints an error' do
expect { subject.unpack }.to raise_error SystemExit expect { subject.unpack }.to raise_error SystemExit
expect(progress).to have_received(:puts) expect(progress).to have_received(:puts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment