|
|
|
@ -5,6 +5,7 @@ from celery import shared_task
|
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
|
|
|
|
from accounts.backends import vault_client
|
|
|
|
|
from accounts.const import VaultTypeChoices
|
|
|
|
|
from accounts.models import Account, AccountTemplate
|
|
|
|
|
from common.utils import get_logger
|
|
|
|
|
from orgs.utils import tmp_to_root_org
|
|
|
|
@ -39,6 +40,9 @@ def sync_secret_to_vault():
|
|
|
|
|
# 这里不能判断 settings.VAULT_ENABLED, 必须判断当前 vault_client 的类型
|
|
|
|
|
print('\033[35m>>> 当前 Vault 功能未开启, 不需要同步')
|
|
|
|
|
return
|
|
|
|
|
if VaultTypeChoices.local == vault_client.type:
|
|
|
|
|
print('\033[31m>>> 当前第三方 Vault 客户端初始化失败,数据存储在本地数据库')
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
failed, skipped, succeeded = 0, 0, 0
|
|
|
|
|
to_sync_models = [Account, AccountTemplate, Account.history.model]
|
|
|
|
|