Merge pull request #9659 from jumpserver/pr@dev@fix_deployment

fix: 修复应用发布状态
pull/9649/head
Eric_Lee 2 years ago committed by GitHub
commit f46b707f70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,7 +58,7 @@ class AppletHostDeploymentViewSet(viewsets.ModelViewSet):
def applets(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
applet_id = serializer.validated_data.get('applet_id')
applet_id = serializer.validated_data.pop('applet_id')
instance = serializer.save()
task = run_applet_host_deployment_install_applet.delay(instance.id, applet_id)
instance.save_task(task.id)

@ -10,6 +10,7 @@ from simple_history.utils import bulk_create_with_history
from assets.models import Host
from common.db.models import JMSBaseModel
from common.utils import random_string
from terminal.const import PublishStatus
__all__ = ['AppletHost', 'AppletHostDeployment']
@ -63,11 +64,11 @@ class AppletHost(Host):
status_applets = defaultdict(list)
for applet in applets:
if applet.name not in name_version_mapper:
status_applets['unpublished'].append(applet)
status_applets[PublishStatus.failed.value].append(applet)
elif applet.version != name_version_mapper[applet.name]:
status_applets['not_match'].append(applet)
status_applets[PublishStatus.mismatch.value].append(applet)
else:
status_applets['published'].append(applet)
status_applets[PublishStatus.success.value].append(applet)
for status, applets in status_applets.items():
self.publications.filter(applet__in=applets) \

Loading…
Cancel
Save