fix: 修复wateway api (#7947)

Co-authored-by: feng626 <1304903146@qq.com>
pull/7950/head
fit2bot 2022-03-21 17:53:16 +08:00 committed by GitHub
parent 9ae74120ed
commit 3345456dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ from perms.filters import AssetPermissionFilter
from orgs.mixins.api import OrgBulkModelViewSet from orgs.mixins.api import OrgBulkModelViewSet
from orgs.mixins import generics from orgs.mixins import generics
from assets.api import FilterAssetByNodeMixin from assets.api import FilterAssetByNodeMixin
from ..models import Asset, Node, Platform from ..models import Asset, Node, Platform, Gateway
from .. import serializers from .. import serializers
from ..tasks import ( from ..tasks import (
update_assets_hardware_info_manual, test_assets_connectivity_manual, update_assets_hardware_info_manual, test_assets_connectivity_manual,
@ -199,7 +199,7 @@ class AssetGatewayListApi(generics.ListAPIView):
asset_id = self.kwargs.get('pk') asset_id = self.kwargs.get('pk')
asset = get_object_or_404(Asset, pk=asset_id) asset = get_object_or_404(Asset, pk=asset_id)
if not asset.domain: if not asset.domain:
return [] return Gateway.objects.none()
queryset = asset.domain.gateways.filter(protocol='ssh') queryset = asset.domain.gateways.filter(protocol='ssh')
return queryset return queryset