mirror of https://github.com/jumpserver/jumpserver
perf: 优化代码
parent
0589f7fe33
commit
d71374ca8a
|
@ -159,24 +159,21 @@ class AppletHostDeployment(JMSBaseModel):
|
||||||
manager.run()
|
manager.run()
|
||||||
|
|
||||||
def install_applet(self, applet_id, **kwargs):
|
def install_applet(self, applet_id, **kwargs):
|
||||||
from ...automations.deploy_applet_host import DeployAppletHostManager
|
manager = self.create_deploy_manager(applet_id, **kwargs)
|
||||||
from .applet import Applet
|
|
||||||
if applet_id:
|
|
||||||
applet = Applet.objects.get(id=applet_id)
|
|
||||||
else:
|
|
||||||
applet = None
|
|
||||||
manager = DeployAppletHostManager(self, applet=applet)
|
|
||||||
manager.install_applet(**kwargs)
|
manager.install_applet(**kwargs)
|
||||||
|
|
||||||
def uninstall_applet(self, applet_id, **kwargs):
|
def uninstall_applet(self, applet_id, **kwargs):
|
||||||
|
manager = self.create_deploy_manager(applet_id, **kwargs)
|
||||||
|
manager.uninstall_applet(**kwargs)
|
||||||
|
|
||||||
|
def create_deploy_manager(self, applet_id, **kwargs):
|
||||||
from ...automations.deploy_applet_host import DeployAppletHostManager
|
from ...automations.deploy_applet_host import DeployAppletHostManager
|
||||||
from .applet import Applet
|
from .applet import Applet
|
||||||
if applet_id:
|
if applet_id:
|
||||||
applet = Applet.objects.get(id=applet_id)
|
applet = Applet.objects.get(id=applet_id)
|
||||||
else:
|
else:
|
||||||
applet = None
|
applet = None
|
||||||
manager = DeployAppletHostManager(self, applet=applet)
|
return DeployAppletHostManager(self, applet=applet)
|
||||||
manager.uninstall_applet(**kwargs)
|
|
||||||
|
|
||||||
def save_task(self, task):
|
def save_task(self, task):
|
||||||
self.task = task
|
self.task = task
|
||||||
|
|
Loading…
Reference in New Issue