From fa1635b000e984207f86b8f98a13647bc97e922f Mon Sep 17 00:00:00 2001 From: wyyalt Date: Wed, 3 Jan 2024 15:14:25 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=20Agent=202.0=20Proxy=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=BB=93=E6=9E=84=E5=8F=98=E6=9B=B4=E3=80=81=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E3=80=81=E9=87=8D=E8=BD=BD=E9=80=82=E9=85=8D=20(close?= =?UTF-8?q?d=20#2033)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent_new/render_and_push_gse_config.py | 2 +- .../subscription/steps/agent_adapter/adapter.py | 11 ++++++----- .../subscription/steps/agent_adapter/legacy.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/backend/components/collections/agent_new/render_and_push_gse_config.py b/apps/backend/components/collections/agent_new/render_and_push_gse_config.py index 13b2a7c69..8a88450c9 100644 --- a/apps/backend/components/collections/agent_new/render_and_push_gse_config.py +++ b/apps/backend/components/collections/agent_new/render_and_push_gse_config.py @@ -39,7 +39,7 @@ def get_config_info_list( filename=file_name, node_type=general_node_type, ap=host_ap, - agent_version=host_id__agent_state_info.get(host.bk_host_id, {}).get("version"), + target_version=host_id__agent_state_info.get(host.bk_host_id, {}).get("version"), ), } ) diff --git a/apps/backend/subscription/steps/agent_adapter/adapter.py b/apps/backend/subscription/steps/agent_adapter/adapter.py index 91a8cc2f9..aea7b186b 100644 --- a/apps/backend/subscription/steps/agent_adapter/adapter.py +++ b/apps/backend/subscription/steps/agent_adapter/adapter.py @@ -102,12 +102,13 @@ def _get_config( ap: models.AccessPoint, proxies: typing.List[models.Host], install_channel: typing.Tuple[typing.Optional[models.Host], typing.Dict[str, typing.List]], - agent_version: typing.Optional[typing.Dict[int, str]] = None, + target_version: typing.Optional[typing.Dict[int, str]] = None, ) -> str: agent_setup_info: base.AgentSetupInfo = self.setup_info # 目标版本优先使用传入版本,传入版本必不会是标签所以可直接使用 - target_version: str = agent_version or agent_setup_info.version - config_handler: GseConfigHandler = self.get_config_handler(agent_setup_info.name, target_version) + config_handler: GseConfigHandler = self.get_config_handler( + agent_setup_info.name, target_version or agent_setup_info.version + ) config_tmpl_obj: base.AgentConfigTemplate = config_handler.get_matching_config_tmpl( os_type=host.os_type, cpu_arch=host.cpu_arch, @@ -137,7 +138,7 @@ def get_config( ap: typing.Optional[models.AccessPoint] = None, proxies: typing.Optional[typing.List[models.Host]] = None, install_channel: typing.Tuple[typing.Optional[models.Host], typing.Dict[str, typing.List]] = None, - agent_version: typing.Optional[str] = None, + target_version: typing.Optional[str] = None, ) -> str: """ 获取配置 @@ -162,7 +163,7 @@ def get_config( ap=ap, proxies=proxies, install_channel=install_channel, - agent_version=agent_version, + target_version=target_version, ) @property diff --git a/apps/backend/subscription/steps/agent_adapter/legacy.py b/apps/backend/subscription/steps/agent_adapter/legacy.py index 8a95f1734..a9a1e4cc5 100644 --- a/apps/backend/subscription/steps/agent_adapter/legacy.py +++ b/apps/backend/subscription/steps/agent_adapter/legacy.py @@ -458,7 +458,7 @@ def generate_gse_config( ap: models.AccessPoint, proxies: List[models.Host], install_channel: Tuple[Optional[models.Host], Dict[str, List]], - agent_version: Optional[Dict[int, str]] = None, + target_version: Optional[Dict[int, str]] = None, ): """ 生成 GSE 相关配置