Skip to content

Commit

Permalink
optimization: 安装Gse2.0 查询Agent状态优化 (closed TencentBlueKing#1883)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt committed Oct 25, 2023
1 parent 216e6f0 commit 0bbb0ee
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
class UpgradeToAgentIDService(AgentBaseService):
def _execute(self, data, parent_data, common_data: AgentCommonData):
cloud_ip__sub_inst_id_map: Dict[str, int] = {}
# 如果主机有AgentID,则调用 upgrade_to_agent_id 将基于 Host IP 的配置升级到基于 Agent-ID 的配置
for _, sub_inst_id in common_data.host_id__sub_inst_id_map.items():
cloud_ip__sub_inst_id_map[f"{host.bk_cloud_id}:{host.inner_ip}"] = sub_inst_id

# 如果主机有AgentID,则调用 upgrade_to_agent_id 将基于 Host IP 的配置升级到基于 Agent-ID 的配
upgrade_hosts: List[Dict[str, Union[int, str]]] = []

for host in common_data.host_id_obj_map.values():
sub_inst_id = common_data.host_id__sub_inst_id_map[host.bk_host_id]
sub_inst = common_data.sub_inst_id__sub_inst_obj_map[sub_inst_id]
bk_agent_id: Optional[str] = sub_inst.instance_info["host"].get("bk_agent_id") or host.bk_agent_id
cloud_ip__sub_inst_id_map[f"{host.bk_cloud_id}:{host.inner_ip}"] = sub_inst_id

if bk_agent_id:
upgrade_hosts.append({
Expand Down

0 comments on commit 0bbb0ee

Please sign in to comment.