perf: Navicat为xpack功能 (#9650)

* perf: Navicat移动到xpack功能

* 优化

* fix: 去掉多余的import

* perf: 优化逻辑

* perf: 修改打印位置
pull/9649/head
jiangweidong 2 years ago committed by GitHub
parent c8e1660f7e
commit b5347be4e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,9 +11,9 @@ def install_or_update_builtin_applets():
path = os.path.join(BASE_DIR, d)
if not os.path.isdir(path) or not os.path.exists(os.path.join(path, 'manifest.yml')):
continue
print("Install or update applet: {}".format(path))
try:
Applet.install_from_dir(path)
if Applet.install_from_dir(path):
print("Install or update applet: {}".format(path))
except Exception as e:
print(e)

@ -12,6 +12,7 @@ from rest_framework.serializers import ValidationError
from common.db.models import JMSBaseModel
from common.utils import lazyproperty, get_logger
from jumpserver.utils import has_valid_xpack_license
logger = get_logger(__name__)
@ -95,6 +96,9 @@ class Applet(JMSBaseModel):
manifest = cls.validate_pkg(path)
name = manifest['name']
if not has_valid_xpack_license() and name.lower() in ('navicat', ):
return
instance = cls.objects.filter(name=name).first()
serializer = AppletSerializer(instance=instance, data=manifest)
serializer.is_valid()

Loading…
Cancel
Save