Skip to content

Commit

Permalink
fix: windows机器检查sshd服务时抛出异常 (closed TencentBlueKing#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ping15 committed Oct 17, 2024
1 parent 8ebfc53 commit c416c26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/backend/components/collections/agent_new/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ async def execute_shell_solution_async(

async with conns.AsyncsshConn(**install_sub_inst_obj.conns_init_params) as conn:
if install_sub_inst_obj.host.os_type == constants.OsType.WINDOWS:
sshd_info = await conn.run(POWERSHELL_SERVICE_CHECK_SSHD, check=True, timeout=SSH_RUN_TIMEOUT)
sshd_info = await conn.run(POWERSHELL_SERVICE_CHECK_SSHD, check=False, timeout=SSH_RUN_TIMEOUT)
if sshd_info.exit_status == 0 and "cygwin" not in sshd_info.stdout.lower():
self.build_shell_to_batch_command_converter(execution_solution.steps, command_converter)

Expand Down
2 changes: 1 addition & 1 deletion script_tools/setup_pagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def execute_shell_solution(
) as conn:
command_converter = {}
if os_type == "windows":
run_output: RunOutput = conn.run(POWERSHELL_SERVICE_CHECK_SSHD, check=True, timeout=30)
run_output: RunOutput = conn.run(POWERSHELL_SERVICE_CHECK_SSHD, check=False, timeout=30)
if run_output.exit_status == 0 and "cygwin" not in run_output.stdout.lower():
for step in execution_solution["steps"]:
if step["type"] != "commands":
Expand Down

0 comments on commit c416c26

Please sign in to comment.