perf: 优化 xpack license 检查 (#11885)

Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot
2023-10-18 14:10:24 +08:00
committed by GitHub
parent f088bbce12
commit d3a283232f
10 changed files with 24 additions and 39 deletions

View File

@@ -1,9 +1,9 @@
from django.conf import settings
from django.db import models
from django.utils.translation import gettext_lazy as _
from accounts.const import AutomationTypes
from accounts.models import Account
from jumpserver.utils import has_valid_xpack_license
from .base import AccountBaseAutomation
from .change_secret import ChangeSecretMixin
@@ -41,7 +41,7 @@ class PushAccountAutomation(ChangeSecretMixin, AccountBaseAutomation):
def save(self, *args, **kwargs):
self.type = AutomationTypes.push_account
if not has_valid_xpack_license():
if not settings.XPACK_LICENSE_IS_VALID:
self.is_periodic = False
super().save(*args, **kwargs)