mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-31 06:22:56 +00:00
fix: 修复remoteapp获取asset_info失败的问题
This commit is contained in:
parent
726fd94f65
commit
70055b8af2
@ -39,14 +39,14 @@ class RemoteAppSerializer(serializers.Serializer):
|
||||
@staticmethod
|
||||
def get_asset_info(obj):
|
||||
asset_id = obj.get('asset')
|
||||
if not asset_id or is_uuid(asset_id):
|
||||
if not asset_id or not is_uuid(asset_id):
|
||||
return {}
|
||||
try:
|
||||
asset = Asset.objects.filter(id=str(asset_id)).values_list('id', 'hostname')
|
||||
asset = Asset.objects.get(id=str(asset_id))
|
||||
except ObjectDoesNotExist as e:
|
||||
logger.error(e)
|
||||
return {}
|
||||
if not asset:
|
||||
return {}
|
||||
asset_info = {'id': str(asset[0]), 'hostname': asset[1]}
|
||||
asset_info = {'id': str(asset.id), 'hostname': asset.hostname}
|
||||
return asset_info
|
||||
|
Loading…
Reference in New Issue
Block a user