Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/DiffusionSSHWorkflow.php
| Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | protected function getCurrentDeviceName() { | ||||
| return php_uname('n'); | return php_uname('n'); | ||||
| } | } | ||||
| protected function shouldProxy() { | protected function shouldProxy() { | ||||
| return $this->shouldProxy; | return $this->shouldProxy; | ||||
| } | } | ||||
| protected function getProxyCommand($for_write) { | final protected function getAlmanacServiceRefs($for_write) { | ||||
| $viewer = $this->getSSHUser(); | $viewer = $this->getSSHUser(); | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $is_cluster_request = $this->getIsClusterRequest(); | $is_cluster_request = $this->getIsClusterRequest(); | ||||
| $uri = $repository->getAlmanacServiceURI( | $refs = $repository->getAlmanacServiceRefs( | ||||
| $viewer, | $viewer, | ||||
| array( | array( | ||||
| 'neverProxy' => $is_cluster_request, | 'neverProxy' => $is_cluster_request, | ||||
| 'protocols' => array( | 'protocols' => array( | ||||
| 'ssh', | 'ssh', | ||||
| ), | ), | ||||
| 'writable' => $for_write, | 'writable' => $for_write, | ||||
| )); | )); | ||||
| if (!$uri) { | if (!$refs) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Failed to generate an intracluster proxy URI even though this '. | 'Failed to generate an intracluster proxy URI even though this '. | ||||
| 'request was routed as a proxy request.')); | 'request was routed as a proxy request.')); | ||||
| } | } | ||||
| $uri = new PhutilURI($uri); | return $refs; | ||||
| } | |||||
| final protected function getProxyCommand($for_write) { | |||||
| $refs = $this->getAlmanacServiceRefs($for_write); | |||||
| $ref = head($refs); | |||||
| return $this->getProxyCommandForServiceRef($ref); | |||||
| } | |||||
| final protected function getProxyCommandForServiceRef( | |||||
| DiffusionServiceRef $ref) { | |||||
| $uri = new PhutilURI($ref->getURI()); | |||||
| $username = AlmanacKeys::getClusterSSHUser(); | $username = AlmanacKeys::getClusterSSHUser(); | ||||
| if ($username === null) { | if ($username === null) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Unable to determine the username to connect with when trying '. | 'Unable to determine the username to connect with when trying '. | ||||
| 'to proxy an SSH request within the Phabricator cluster.')); | 'to proxy an SSH request within the Phabricator cluster.')); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines | |||||