@@ -375,11 +375,12 @@ func (tc *testContext) runPowerShellSSHJob(name, command, ip string) (string, er
375375 }
376376
377377 keyMountDir := "/private-key"
378+ sshOptions := "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
378379 sshCommand := []string {"bash" , "-c" ,
379380 fmt .Sprintf (
380381 // first determine if the host has PowerShell or cmd as the default shell by running a simple PowerShell
381382 // command. If it succeeds, then the host's default shell is PowerShell
382- "if ssh -o StrictHostKeyChecking=no -i %s %s@%s 'Get-Help';" +
383+ "if ssh " + sshOptions + " -i %s %s@%s 'Get-Help';"+
383384 "then CMD_PREFIX=\" \" ;CMD_SUFFIX=\" \" ;" +
384385 // to respect quoting within the given command, wrap the command as a script block
385386 "COMMAND='{" + powershellDefaultCommand + "}';" +
@@ -388,7 +389,7 @@ func (tc *testContext) runPowerShellSSHJob(name, command, ip string) (string, er
388389 "COMMAND='{" + command + "}';" +
389390 "fi;" +
390391 // execute the command as a script block via the PowerShell call operator `&`
391- "ssh -o StrictHostKeyChecking=no -i %s %s@%s ${CMD_PREFIX}\" & $COMMAND \" ${CMD_SUFFIX}" ,
392+ "ssh " + sshOptions + " -i %s %s@%s ${CMD_PREFIX}\" & $COMMAND \" ${CMD_SUFFIX}" ,
392393 filepath .Join (keyMountDir , secrets .PrivateKeySecretKey ), tc .vmUsername (), ip ,
393394 filepath .Join (keyMountDir , secrets .PrivateKeySecretKey ), tc .vmUsername (), ip )}
394395
0 commit comments