perf: k8s token 不过期 (#9460)

Co-authored-by: feng <1304903146@qq.com>
pull/9461/head
fit2bot 2 years ago committed by GitHub
parent 8c65429157
commit 32afa214fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,6 +23,7 @@ from orgs.mixins.api import RootOrgViewMixin
from perms.models import ActionChoices
from terminal.connect_methods import NativeClient, ConnectMethodUtil
from terminal.models import EndpointRule
from assets.const import CloudTypes
from ..models import ConnectionToken
from ..serializers import (
ConnectionTokenSerializer, ConnectionTokenSecretSerializer,
@ -340,6 +341,11 @@ class SuperConnectionTokenViewSet(ConnectionTokenViewSet):
token.is_valid()
serializer = self.get_serializer(instance=token)
expire_now = request.data.get('expire_now', True)
# TODO 暂时特殊处理 k8s 不过期
if token.asset.type == CloudTypes.K8S:
expire_now = False
if expire_now:
token.expire()
return Response(serializer.data, status=status.HTTP_200_OK)

Loading…
Cancel
Save