Skip to content

Commit

Permalink
feat: 安装接口增加force_update_agent_id参数 (closed #2132)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt authored and ZhuoZhuoCrayon committed Mar 26, 2024
1 parent 91efff7 commit e5b5681
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/backend/agent/solution_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def get_run_cmd_base_params(self) -> typing.List[str]:
# 因 bat 脚本逻辑,-R 参数只能放在最后一位
if self.is_uninstall:
run_cmd_params.extend(["-R"])
if self.agent_setup_info.force_update_agent_id:
if not self.agent_setup_info.is_legacy and self.agent_setup_info.force_update_agent_id:
run_cmd_params.extend(["-F"])

return list(filter(None, run_cmd_params))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def _execute(self, data, parent_data, common_data: AgentCommonData):

# AP_ID 偏移规则 ap_id * 100000 + install_channel_id
offset_ap_id = ap_id * INSTALL_OTHER_AGENT_AP_ID_OFFSET + (host.install_channel_id or 0)
agent_setup_extra_info_dict = sub_inst.instance_info["host"].get("agent_setup_extra_info") or {}
host_info: Dict[str, Any] = {
"bk_host_id": host.bk_host_id,
"os_type": host.os_type,
Expand All @@ -112,6 +113,7 @@ def _execute(self, data, parent_data, common_data: AgentCommonData):
"install_channel_id": host.install_channel_id,
"peer_exchange_switch_for_agent": host.extra_data.get("peer_exchange_switch_for_agent", 0),
"enable_compression": host.extra_data.get("enable_compression", False),
"force_update_agent_id": agent_setup_extra_info_dict.get("force_update_agent_id", False),
}

hosts.append(host_info)
Expand Down
1 change: 1 addition & 0 deletions apps/node_man/serializers/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class HostSerializer(InstallBaseSerializer):
is_need_inject_ap_id = serializers.BooleanField(label=_("是否需要注入ap_id到meta"), required=False, default=False)
enable_compression = serializers.BooleanField(label=_("数据压缩开关"), required=False, default=False)
is_use_ap_map = serializers.BooleanField(label=_("是否使用映射接入点"), required=False, default=False)
force_update_agent_id = serializers.BooleanField(label=_("是否更新agent_id"), required=False, default=False)

def validate(self, attrs):
# 获取任务类型,如果是除安装以外的操作,则密码和秘钥可以为空
Expand Down

0 comments on commit e5b5681

Please sign in to comment.