forked from fedi/mastodon
Storage: add :azure to remaining callers (#26080)
This commit is contained in:
parent
6c3c5bbbc3
commit
12a6cf569e
|
@ -10,7 +10,7 @@ class BackupsController < ApplicationController
|
||||||
|
|
||||||
def download
|
def download
|
||||||
case Paperclip::Attachment.default_options[:storage]
|
case Paperclip::Attachment.default_options[:storage]
|
||||||
when :s3
|
when :s3, :azure
|
||||||
redirect_to @backup.dump.expiring_url(10), allow_other_host: true
|
redirect_to @backup.dump.expiring_url(10), allow_other_host: true
|
||||||
when :fog
|
when :fog
|
||||||
if Paperclip::Attachment.default_options.dig(:fog_credentials, :openstack_temp_url_key).present?
|
if Paperclip::Attachment.default_options.dig(:fog_credentials, :openstack_temp_url_key).present?
|
||||||
|
|
|
@ -76,6 +76,9 @@ class AttachmentBatch
|
||||||
when :fog
|
when :fog
|
||||||
logger.debug { "Deleting #{attachment.path(style)}" }
|
logger.debug { "Deleting #{attachment.path(style)}" }
|
||||||
attachment.directory.files.new(key: attachment.path(style)).destroy
|
attachment.directory.files.new(key: attachment.path(style)).destroy
|
||||||
|
when :azure
|
||||||
|
logger.debug { "Deleting #{attachment.path(style)}" }
|
||||||
|
attachment.destroy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@ class SuspendAccountService < BaseService
|
||||||
rescue Aws::S3::Errors::NotImplemented => e
|
rescue Aws::S3::Errors::NotImplemented => e
|
||||||
Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}"
|
Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}"
|
||||||
end
|
end
|
||||||
when :fog
|
when :fog, :azure
|
||||||
# Not supported
|
# Not supported
|
||||||
when :filesystem
|
when :filesystem
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -81,7 +81,7 @@ class UnsuspendAccountService < BaseService
|
||||||
rescue Aws::S3::Errors::NotImplemented => e
|
rescue Aws::S3::Errors::NotImplemented => e
|
||||||
Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}"
|
Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}"
|
||||||
end
|
end
|
||||||
when :fog
|
when :fog, :azure
|
||||||
# Not supported
|
# Not supported
|
||||||
when :filesystem
|
when :filesystem
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -158,6 +158,9 @@ module Mastodon::CLI
|
||||||
when :fog
|
when :fog
|
||||||
say('The fog storage driver is not supported for this operation at this time', :red)
|
say('The fog storage driver is not supported for this operation at this time', :red)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
when :azure
|
||||||
|
say('The azure storage driver is not supported for this operation at this time', :red)
|
||||||
|
exit(1)
|
||||||
when :filesystem
|
when :filesystem
|
||||||
require 'find'
|
require 'find'
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ module Mastodon::CLI
|
||||||
upgrade_storage_s3(progress, attachment, style)
|
upgrade_storage_s3(progress, attachment, style)
|
||||||
when :fog
|
when :fog
|
||||||
upgrade_storage_fog(progress, attachment, style)
|
upgrade_storage_fog(progress, attachment, style)
|
||||||
|
when :azure
|
||||||
|
upgrade_storage_azure(progress, attachment, style)
|
||||||
when :filesystem
|
when :filesystem
|
||||||
upgrade_storage_filesystem(progress, attachment, style)
|
upgrade_storage_filesystem(progress, attachment, style)
|
||||||
end
|
end
|
||||||
|
@ -105,6 +107,11 @@ module Mastodon::CLI
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def upgrade_storage_azure(_progress, _attachment, _style)
|
||||||
|
say('The azure storage driver is not supported for this operation at this time', :red)
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
def upgrade_storage_filesystem(progress, attachment, style)
|
def upgrade_storage_filesystem(progress, attachment, style)
|
||||||
previous_storage_schema_version = attachment.storage_schema_version
|
previous_storage_schema_version = attachment.storage_schema_version
|
||||||
previous_path = attachment.path(style)
|
previous_path = attachment.path(style)
|
||||||
|
|
Loading…
Reference in a new issue