@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow timeouts to be specified on Drydock SSH connections

Summary: This allows timeouts to be specified on SSH connections that Drydock makes. Used in the EC2 allocator to poll for the SSH server starting.

Test Plan: Used in EC2 allocator diff.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10225

+18 -1
+18 -1
src/applications/drydock/interface/command/DrydockSSHCommandInterface.php
··· 3 3 final class DrydockSSHCommandInterface extends DrydockCommandInterface { 4 4 5 5 private $passphraseSSHKey; 6 + private $connectTimeout; 6 7 7 8 private function openCredentialsIfNotOpen() { 8 9 if ($this->passphraseSSHKey !== null) { ··· 25 26 PhabricatorUser::getOmnipotentUser()); 26 27 } 27 28 29 + public function setConnectTimeout($timeout) { 30 + $this->connectTimeout = $timeout; 31 + return $this; 32 + } 33 + 28 34 public function getExecFuture($command) { 29 35 $this->openCredentialsIfNotOpen(); 30 36 ··· 44 50 $full_command = 'C:\\Windows\\system32\\cmd.exe /C '.$full_command; 45 51 } 46 52 53 + $command_timeout = ''; 54 + if ($this->connectTimeout !== null) { 55 + $command_timeout = csprintf( 56 + '-o %s', 57 + 'ConnectTimeout='.$this->connectTimeout); 58 + } 59 + 47 60 return new ExecFuture( 48 - 'ssh -o StrictHostKeyChecking=no -p %s -i %P %P@%s -- %s', 61 + 'ssh '. 62 + '-o StrictHostKeyChecking=no '. 63 + '-o BatchMode=yes '. 64 + '%C -p %s -i %P %P@%s -- %s', 65 + $command_timeout, 49 66 $this->getConfig('port'), 50 67 $this->passphraseSSHKey->getKeyfileEnvelope(), 51 68 $this->passphraseSSHKey->getUsernameEnvelope(),