Skip to content

Commit

Permalink
bugfix: Windows 重启 Agent 脚本失效 (closed #1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
CohleRustW authored and ZhuoZhuoCrayon committed Nov 10, 2023
1 parent 994653c commit bf82c22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions apps/backend/components/collections/agent_new/restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def get_script_content(self, data, common_data: AgentCommonData, host: models.Ho
general_node_type = self.get_general_node_type(host.node_type)
host_ap: models.AccessPoint = self.get_host_ap(common_data=common_data, host=host)
setup_path = host_ap.get_agent_config(host.os_type)["setup_path"]
agent_path = path_handler.join(setup_path, general_node_type, "bin", ctl_exe_name)
agent_bin_path = path_handler.join(setup_path, general_node_type, "bin")
execute_command = f"{ctl_exe_name} {cmd_suffix}"

return f"{agent_path} {cmd_suffix}"
return f"cd {agent_bin_path} && {execute_command}"
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def tearDown(self) -> None:
record = self.job_api_mock_client.call_recorder.record
fast_execute_script_query_params = record[JobApi.fast_execute_script][0].args[0]
self.assertEqual(
"c:\\gse\\agent\\bin\\gsectl.bat restart",
"cd c:\\gse\\agent\\bin && gsectl.bat restart",
base64.b64decode(fast_execute_script_query_params["script_content"]).decode(),
)
super().tearDown()
Expand Down

0 comments on commit bf82c22

Please sign in to comment.