mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-01 03:15:23 +00:00
fix: (smart endpoint 获取500的问题) (修复监控会话打开失败的问题)
This commit is contained in:
parent
e590518108
commit
953adf6cfb
@ -74,7 +74,7 @@ class Endpoint(JMSBaseModel):
|
||||
from assets.models import Asset
|
||||
from terminal.models import Session
|
||||
if isinstance(instance, Session):
|
||||
instance = instance.get_asset_or_application()
|
||||
instance = instance.get_asset()
|
||||
if not isinstance(instance, Asset):
|
||||
return None
|
||||
values = instance.labels.filter(name='endpoint').values_list('value', flat=True)
|
||||
|
@ -178,14 +178,11 @@ class Session(OrgModelMixin):
|
||||
def login_from_display(self):
|
||||
return self.get_login_from_display()
|
||||
|
||||
def get_asset_or_application(self):
|
||||
instance = get_object_or_none(Asset, pk=self.asset_id)
|
||||
if not instance:
|
||||
instance = get_object_or_none(Application, pk=self.asset_id)
|
||||
return instance
|
||||
def get_asset(self):
|
||||
return get_object_or_none(Asset, pk=self.asset_id)
|
||||
|
||||
def get_target_ip(self):
|
||||
instance = self.get_asset_or_application()
|
||||
instance = self.get_asset()
|
||||
target_ip = instance.get_target_ip() if instance else ''
|
||||
return target_ip
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user