mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Drop Windows-specific SSH code
Summary: Ref T2015. This code is only relevant when attempting to run commands on a Windows host over SSH. Since SSH on Windows is extremely fragile and hard to maintain, and WinRM is a better long-term solution, drop this code (which will end up being unused when later diffs introduce the WinRM command interface). Test Plan: This code won't be used when D10495 lands. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Projects: #drydock Maniphest Tasks: T2015 Differential Revision: https://secure.phabricator.com/D13340
This commit is contained in:
parent
68bb60e52f
commit
827aa05a67
1 changed files with 2 additions and 40 deletions
|
@ -42,46 +42,8 @@ final class DrydockSSHCommandInterface extends DrydockCommandInterface {
|
|||
$this->openCredentialsIfNotOpen();
|
||||
|
||||
$argv = func_get_args();
|
||||
|
||||
if ($this->getConfig('platform') === 'windows') {
|
||||
// Handle Windows by executing the command under PowerShell.
|
||||
$command = id(new PhutilCommandString($argv))
|
||||
->setEscapingMode(PhutilCommandString::MODE_POWERSHELL);
|
||||
|
||||
$change_directory = '';
|
||||
if ($this->getWorkingDirectory() !== null) {
|
||||
$change_directory .= 'cd '.$this->getWorkingDirectory();
|
||||
}
|
||||
|
||||
$script = <<<EOF
|
||||
$change_directory
|
||||
$command
|
||||
if (\$LastExitCode -ne 0) {
|
||||
exit \$LastExitCode
|
||||
}
|
||||
EOF;
|
||||
|
||||
// When Microsoft says "Unicode" they don't mean UTF-8.
|
||||
$script = mb_convert_encoding($script, 'UTF-16LE');
|
||||
|
||||
$script = base64_encode($script);
|
||||
|
||||
$powershell =
|
||||
'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe';
|
||||
$powershell .=
|
||||
' -ExecutionPolicy Bypass'.
|
||||
' -NonInteractive'.
|
||||
' -InputFormat Text'.
|
||||
' -OutputFormat Text'.
|
||||
' -EncodedCommand '.$script;
|
||||
|
||||
$full_command = $powershell;
|
||||
} else {
|
||||
// Handle UNIX by executing under the native shell.
|
||||
$argv = $this->applyWorkingDirectoryToArgv($argv);
|
||||
|
||||
$full_command = call_user_func_array('csprintf', $argv);
|
||||
}
|
||||
$argv = $this->applyWorkingDirectoryToArgv($argv);
|
||||
$full_command = call_user_func_array('csprintf', $argv);
|
||||
|
||||
$command_timeout = '';
|
||||
if ($this->connectTimeout !== null) {
|
||||
|
|
Loading…
Reference in a new issue