Commit 5a8cf78d authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Move conditional to a separate method

parent 295524bb
...@@ -110,9 +110,7 @@ module Backup ...@@ -110,9 +110,7 @@ module Backup
elsif backup_file_list.many? && ENV["BACKUP"].nil? elsif backup_file_list.many? && ENV["BACKUP"].nil?
$progress.puts 'Found more than one backup:' $progress.puts 'Found more than one backup:'
# print list of available backups # print list of available backups
backup_file_list.each do |item| $progress.puts " " + available_timestamps.join("\n ")
$progress.puts " " + item.gsub("#{FILE_NAME_SUFFIX}", "")
end
$progress.puts 'Please specify which one you want to restore:' $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
...@@ -174,6 +172,10 @@ module Backup ...@@ -174,6 +172,10 @@ module Backup
@backup_file_list ||= Dir.glob("*#{FILE_NAME_SUFFIX}") @backup_file_list ||= Dir.glob("*#{FILE_NAME_SUFFIX}")
end end
def available_timestamps
@backup_file_list.map {|item| item.gsub("#{FILE_NAME_SUFFIX}", "")}
end
def connect_to_remote_directory(connection_settings) def connect_to_remote_directory(connection_settings)
# our settings use string keys, but Fog expects symbols # our settings use string keys, but Fog expects symbols
connection = ::Fog::Storage.new(connection_settings.symbolize_keys) connection = ::Fog::Storage.new(connection_settings.symbolize_keys)
......
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