diff options
author | Balasankar "Balu" C <balasankar@gitlab.com> | 2018-01-15 23:52:00 +0530 |
---|---|---|
committer | Balasankar "Balu" C <balasankar@gitlab.com> | 2018-01-15 23:52:00 +0530 |
commit | 5a8cf78d5141406bdf6dbfa509b345612323d919 (patch) | |
tree | 89103eee54dfc591ba6c8e4bcf430324abd8f252 /lib/backup | |
parent | 295524bb53e4214d9869553cb01810bf928a775a (diff) | |
download | gitlab-ce-5a8cf78d5141406bdf6dbfa509b345612323d919.tar.gz |
Move conditional to a separate method
Diffstat (limited to 'lib/backup')
-rw-r--r-- | lib/backup/manager.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index c6c6fca6b74..f27ce4d2b2b 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -110,9 +110,7 @@ module Backup elsif backup_file_list.many? && ENV["BACKUP"].nil? $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 " " + available_timestamps.join("\n ") $progress.puts 'Please specify which one you want to restore:' $progress.puts 'rake gitlab:backup:restore BACKUP=timestamp_of_backup' exit 1 @@ -174,6 +172,10 @@ module Backup @backup_file_list ||= Dir.glob("*#{FILE_NAME_SUFFIX}") end + def available_timestamps + @backup_file_list.map {|item| item.gsub("#{FILE_NAME_SUFFIX}", "")} + end + def connect_to_remote_directory(connection_settings) # our settings use string keys, but Fog expects symbols connection = ::Fog::Storage.new(connection_settings.symbolize_keys) |