[Nostromo] Apply Mess Detector recommendations

This commit is contained in:
Andrés Montañez 2017-01-11 21:30:12 -03:00
parent c9ec69e385
commit 949ca7c625

View file

@ -418,7 +418,7 @@ class Runtime
* @param int $timeout Seconds to wait
* @return Process
*/
public function runRemoteCommand($cmd, $jail = true, $timeout = 120)
public function runRemoteCommand($cmd, $jail, $timeout = 120)
{
$user = $this->getEnvParam('user');
$sudo = $this->getEnvParam('sudo', false);
@ -430,13 +430,11 @@ class Runtime
$cmdDelegate = sprintf('sudo %s', $cmd);
}
if ($jail) {
$hostPath = rtrim($this->getEnvParam('host_path'), '/');
if ($this->getReleaseId()) {
$cmdDelegate = sprintf('cd %s/releases/%s && %s', $hostPath, $this->getReleaseId(), $cmdDelegate);
} else {
$cmdDelegate = sprintf('cd %s && %s', $hostPath, $cmdDelegate);
}
$hostPath = rtrim($this->getEnvParam('host_path'), '/');
if ($jail && $this->getReleaseId()) {
$cmdDelegate = sprintf('cd %s/releases/%s && %s', $hostPath, $this->getReleaseId(), $cmdDelegate);
} elseif ($jail) {
$cmdDelegate = sprintf('cd %s && %s', $hostPath, $cmdDelegate);
}
$cmdRemote = str_replace(['"', '&', ';', '|'], ['\"', '\&', '\;', '\|'], $cmdDelegate);