Skip to content

Commit

Permalink
feature: Agent 2.0 Proxy 配置结构变更、升级、重载适配 (closed TencentBlueKing#2033)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt committed Jan 3, 2024
1 parent df7e694 commit fa1635b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
}
)
Expand Down
11 changes: 6 additions & 5 deletions apps/backend/subscription/steps/agent_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
"""
获取配置
Expand All @@ -162,7 +163,7 @@ def get_config(
ap=ap,
proxies=proxies,
install_channel=install_channel,
agent_version=agent_version,
target_version=target_version,
)

@property
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/subscription/steps/agent_adapter/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 相关配置
Expand Down

0 comments on commit fa1635b

Please sign in to comment.