perf: 账号备份增加sftp方式 (#12032)

* perf: 添加sftp支持

* perf: 账号备份增加sftp方式

---------

Co-authored-by: wangruidong <940853815@qq.com>
Co-authored-by: Bryan <jiangjie.bai@fit2cloud.com>
This commit is contained in:
fit2bot
2023-11-07 15:10:46 +08:00
committed by GitHub
parent 54b89f6fee
commit f01bfc44b8
15 changed files with 601 additions and 289 deletions

View File

@@ -1,9 +1,10 @@
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
from common.tasks import send_mail_attachment_async
from common.tasks import send_mail_attachment_async, upload_backup_to_obj_storage
from notifications.notifications import UserMessage
from users.models import User
from terminal.models.component.storage import ReplayStorage
class AccountBackupExecutionTaskMsg(object):
@@ -31,6 +32,25 @@ class AccountBackupExecutionTaskMsg(object):
)
class AccountBackupByObjStorageExecutionTaskMsg(object):
subject = _('Notification of account backup route task results')
def __init__(self, name: str, obj_storage: ReplayStorage):
self.name = name
self.obj_storage = obj_storage
@property
def message(self):
name = self.name
return _('{} - The account backup passage task has been completed.'
' See the attachment for details').format(name)
def publish(self, attachment_list=None):
upload_backup_to_obj_storage(
self.obj_storage, attachment_list
)
class ChangeSecretExecutionTaskMsg(object):
subject = _('Notification of implementation result of encryption change plan')