fix: 双机主备部署sftp备份文件找不到

pull/12251/head
wangruidong 2023-12-04 13:37:32 +08:00 committed by 老广
parent b10ee436e8
commit 0fbbdceec2
2 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,7 @@
from django.template.loader import render_to_string
from django.utils.translation import gettext_lazy as _
from common.tasks import send_mail_attachment_async, upload_backup_to_obj_storage
from common.tasks import send_mail_attachment, upload_backup_to_obj_storage
from notifications.notifications import UserMessage
from users.models import User
from terminal.models.component.storage import ReplayStorage
@ -27,7 +27,7 @@ class AccountBackupExecutionTaskMsg(object):
"to set the encryption password").format(name)
def publish(self, attachment_list=None):
send_mail_attachment_async(
send_mail_attachment(
self.subject, self.message, [self.user.email], attachment_list
)
@ -70,7 +70,7 @@ class ChangeSecretExecutionTaskMsg(object):
"file encryption password to set the encryption password").format(name)
def publish(self, attachments=None):
send_mail_attachment_async(
send_mail_attachment(
self.subject, self.message, [self.user.email], attachments
)

View File

@ -45,8 +45,7 @@ def send_mail_async(*args, **kwargs):
logger.error("Sending mail error: {}".format(e))
@shared_task(verbose_name=_("Send email attachment"), activity_callback=task_activity_callback)
def send_mail_attachment_async(subject, message, recipient_list, attachment_list=None):
def send_mail_attachment(subject, message, recipient_list, attachment_list=None):
if attachment_list is None:
attachment_list = []
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
@ -66,7 +65,6 @@ def send_mail_attachment_async(subject, message, recipient_list, attachment_list
logger.error("Sending mail attachment error: {}".format(e))
@shared_task(verbose_name=_('Upload session replay to external storage'))
def upload_backup_to_obj_storage(recipient, upload_file):
logger.info(f'Start upload file : {upload_file}')
remote_path = os.path.join('account_backup', os.path.basename(upload_file))