Pass cluster.instance to ssh-exec if it is defined
Summary: Ref T7034. This is a second special case, like commit hooks, where we need some help from Phabricator to make instance identity knowable. Test Plan: Connected to an instance and ran SSH commands. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7034 Differential Revision: https://secure.phabricator.com/D11539
This commit is contained in:
@@ -26,7 +26,17 @@ $bin = $root.'/bin/ssh-exec';
|
||||
foreach ($keys as $ssh_key) {
|
||||
$user = $ssh_key->getObject()->getUsername();
|
||||
|
||||
$cmd = csprintf('%s --phabricator-ssh-user %s', $bin, $user);
|
||||
$key_argv = array();
|
||||
$key_argv[] = '--phabricator-ssh-user';
|
||||
$key_argv[] = $user;
|
||||
|
||||
$cmd = csprintf('%s %Ls', $bin, $key_argv);
|
||||
|
||||
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
|
||||
if (strlen($instance)) {
|
||||
$cmd = csprintf('PHABRICATOR_INSTANCE=%s %C', $instance, $cmd);
|
||||
}
|
||||
|
||||
// This is additional escaping for the SSH 'command="..."' string.
|
||||
$cmd = addcslashes($cmd, '"\\');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user