Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/DiffusionGitUploadPackSSHWorkflow.php
Show All 13 Lines | final class DiffusionGitUploadPackSSHWorkflow extends DiffusionGitSSHWorkflow { | ||||
} | } | ||||
protected function executeRepositoryOperations() { | protected function executeRepositoryOperations() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$viewer = $this->getUser(); | $viewer = $this->getUser(); | ||||
$device = AlmanacKeys::getLiveDevice(); | $device = AlmanacKeys::getLiveDevice(); | ||||
$skip_sync = $this->shouldSkipReadSynchronization(); | $skip_sync = $this->shouldSkipReadSynchronization(); | ||||
$is_proxy = $this->shouldProxy(); | |||||
if ($this->shouldProxy()) { | if ($is_proxy) { | ||||
$command = $this->getProxyCommand(); | $command = $this->getProxyCommand(); | ||||
if ($device) { | if ($device) { | ||||
$this->writeClusterEngineLogMessage( | $this->writeClusterEngineLogMessage( | ||||
pht( | pht( | ||||
"# Fetch received by \"%s\", forwarding to cluster host.\n", | "# Fetch received by \"%s\", forwarding to cluster host.\n", | ||||
$device->getName())); | $device->getName())); | ||||
} | } | ||||
Show All 11 Lines | if ($is_proxy) { | ||||
pht( | pht( | ||||
"# Cleared to fetch on cluster host \"%s\".\n", | "# Cleared to fetch on cluster host \"%s\".\n", | ||||
$device->getName())); | $device->getName())); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command); | $command = PhabricatorDaemon::sudoCommandAsDaemonUser($command); | ||||
$pull_event = $this->newPullEvent(); | |||||
$future = id(new ExecFuture('%C', $command)) | $future = id(new ExecFuture('%C', $command)) | ||||
->setEnv($this->getEnvironment()); | ->setEnv($this->getEnvironment()); | ||||
$err = $this->newPassthruCommand() | $err = $this->newPassthruCommand() | ||||
->setIOChannel($this->getIOChannel()) | ->setIOChannel($this->getIOChannel()) | ||||
->setCommandChannelFromExecFuture($future) | ->setCommandChannelFromExecFuture($future) | ||||
->execute(); | ->execute(); | ||||
if ($err) { | |||||
$pull_event | |||||
->setResultType('error') | |||||
->setResultCode($err); | |||||
} else { | |||||
$pull_event | |||||
->setResultType('pull') | |||||
->setResultCode(0); | |||||
} | |||||
// TODO: Currently, when proxying, we do not write a log on the proxy. | |||||
// Perhaps we should write a "proxy log". This is not very useful for | |||||
// statistics or auditing, but could be useful for diagnostics. Marking | |||||
// the proxy logs as proxied (and recording devicePHID on all logs) would | |||||
// make differentiating between these use cases easier. | |||||
if (!$is_proxy) { | |||||
$pull_event->save(); | |||||
} | |||||
if (!$err) { | if (!$err) { | ||||
$this->waitForGitClient(); | $this->waitForGitClient(); | ||||
} | } | ||||
return $err; | return $err; | ||||
} | } | ||||
} | } |