diff options
-rw-r--r-- | lib/backup/registry.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/backup/registry.rb b/lib/backup/registry.rb index 2969b4ac18d..696763bd45a 100644 --- a/lib/backup/registry.rb +++ b/lib/backup/registry.rb @@ -4,7 +4,7 @@ module Backup class Registry < Files attr_reader :object_storage - def initialize(object_storage=false) + def initialize(object_storage = false) @object_storage = object_storage super('registry', Settings.registry.path) end @@ -18,6 +18,7 @@ module Backup end private + def failure_abort(error_message) puts "[Error] #{error_message}".color(:red) abort 'Restore registry failed' @@ -33,7 +34,7 @@ module Backup def backup_existing_registry backup_file_name = "registry.#{Time.now.to_i}" - cmd = %W(s3cmd sync s3://registry s3://tmp/#{backup_file_name}/) + cmd = %W(s3cmd sync s3://registry s3://tmp/#{backup_file_name}/) output, status = Gitlab::Popen.popen(cmd) @@ -41,7 +42,7 @@ module Backup end def cleanup_registry - cmd = %W(s3cmd del --force --recursive s3://registry) + cmd = %w(s3cmd del --force --recursive s3://registry) output, status = Gitlab::Popen.popen(cmd) failure_abort(output) unless status.zero? end @@ -51,7 +52,7 @@ module Backup extracted_tar_path = File.join(Gitlab.config.backup.path, "tmp") FileUtils.mkdir_p(extracted_tar_path, mode: 0700) - failure_abort("#{registry_tar_path} not found") unless File.exists?(registry_tar_path) + failure_abort("#{registry_tar_path} not found") unless File.exist?(registry_tar_path) untar_cmd = %W(tar -xf #{registry_tar_path} -C #{extracted_tar_path}) |