From aef7ac44fff995d62181cef8833cacc81ebb6791 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Thu, 21 Sep 2023 11:23:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?minor:=20=E4=BF=AE=E5=A4=8D=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E6=8F=92=E4=BB=B6=E6=97=A5=E5=BF=97get=5Fpaa?= =?UTF-8?q?s=5Flogs=E7=9A=84401=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_service/plugin_client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugin_service/plugin_client.py b/plugin_service/plugin_client.py index 6a9564d370..30020aaa5d 100644 --- a/plugin_service/plugin_client.py +++ b/plugin_service/plugin_client.py @@ -18,11 +18,7 @@ from django.core.files.uploadedfile import UploadedFile from . import env -from .client_decorators import ( - check_use_plugin_service, - data_parser, - json_response_decoder, -) +from .client_decorators import check_use_plugin_service, data_parser, json_response_decoder from .conf import PLUGIN_CLIENT_LOGGER from .exceptions import PluginServiceException, PluginServiceNotUse @@ -232,8 +228,12 @@ def batch_get_paas_plugin_detailed_info(environment=None, search_term=None, dist def get_paas_logs(plugin_code, trace_id, scroll_id=None, environment=None): """通过PaaS平台查询插件服务日志""" url, data = PluginServiceApiClient._prepare_paas_api_request( - path_params=["system/bk_plugins", plugin_code, "logs"], environment=environment + path_params=["system/bk_plugins", plugin_code, "logs"], environment=environment, force_add_app_info=True ) + + if env.PAASV3_APIGW_API_TOKEN: + url = "{}?private_token={}".format(url, env.PAASV3_APIGW_API_TOKEN) + data.update({"trace_id": trace_id}) if scroll_id: data.update({"scroll_id": scroll_id}) @@ -278,6 +278,7 @@ def _prepare_paas_api_request(path_params: list, environment=None, force_add_app environment or env.APIGW_ENVIRONMENT, *path_params, ) + params = ( {"private_token": env.PAASV3_APIGW_API_TOKEN} if env.PAASV3_APIGW_API_TOKEN From c2870b89e36bb49d31a455aa4ab2577d8ff9e541 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Thu, 21 Sep 2023 11:26:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?minor:=20=E5=8E=BB=E9=99=A4=20force=5Fadd?= =?UTF-8?q?=5Fapp=5Finfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_service/plugin_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_service/plugin_client.py b/plugin_service/plugin_client.py index 30020aaa5d..c07027a865 100644 --- a/plugin_service/plugin_client.py +++ b/plugin_service/plugin_client.py @@ -228,7 +228,7 @@ def batch_get_paas_plugin_detailed_info(environment=None, search_term=None, dist def get_paas_logs(plugin_code, trace_id, scroll_id=None, environment=None): """通过PaaS平台查询插件服务日志""" url, data = PluginServiceApiClient._prepare_paas_api_request( - path_params=["system/bk_plugins", plugin_code, "logs"], environment=environment, force_add_app_info=True + path_params=["system/bk_plugins", plugin_code, "logs"], environment=environment ) if env.PAASV3_APIGW_API_TOKEN: