mirror of https://github.com/jumpserver/jumpserver
fix: 修复新添加发布机不被调度的问题
parent
f46c9f56e8
commit
5b498650cb
|
@ -148,6 +148,11 @@ class Applet(JMSBaseModel):
|
|||
shutil.copytree(path, pkg_path)
|
||||
return instance, serializer
|
||||
|
||||
@classmethod
|
||||
def clear_host_prefer(cls):
|
||||
prefer_key = 'applet_host_prefer_{}'.format("*")
|
||||
cache.delete_pattern(prefer_key)
|
||||
|
||||
def select_host(self, user, asset):
|
||||
hosts = self.hosts.filter(is_active=True)
|
||||
hosts = [host for host in hosts if host.load != 'offline']
|
||||
|
|
|
@ -20,6 +20,8 @@ logger = get_logger(__file__)
|
|||
def on_applet_host_create(sender, instance, created=False, **kwargs):
|
||||
if not created:
|
||||
return
|
||||
Applet.clear_host_prefer()
|
||||
|
||||
applets = Applet.objects.all()
|
||||
instance.applets.set(applets)
|
||||
|
||||
|
|
Loading…
Reference in New Issue