BUGFIX: SSH-jobs are failing terribly
This commit is contained in:
parent
3438201b18
commit
3687fd2a15
|
@ -163,12 +163,19 @@ class Job extends Repository
|
||||||
if ($job['data']['containertype'] == 'docker') {
|
if ($job['data']['containertype'] == 'docker') {
|
||||||
$command = $this->prepareDockerCommand($command, $job['data']['service'], $job['data']['container-user']);
|
$command = $this->prepareDockerCommand($command, $job['data']['service'], $job['data']['container-user']);
|
||||||
}
|
}
|
||||||
if($job['data']['hosttype'] == 'local') {
|
try {
|
||||||
$return = $this->runLocalCommand($command);
|
if($job['data']['hosttype'] == 'local') {
|
||||||
} elseif($job['data']['hosttype'] == 'ssh') {
|
$return = $this->runLocalCommand($command);
|
||||||
$return = $this->runSshCommand($command, $job['data']['host'], $job['data']['user'], $job['data']['ssh-privkey'], $job['data']['privkey-password']);
|
} elseif($job['data']['hosttype'] == 'ssh') {
|
||||||
|
$return = $this->runSshCommand($command, $job['data']['host'], $job['data']['user'], $job['data']['ssh-privkey'], $job['data']['privkey-password']);
|
||||||
|
}
|
||||||
|
$return['failed'] = !in_array($return['exitcode'], $job['data']['response']);
|
||||||
|
} catch (\RuntimeException $exception) {
|
||||||
|
$return['exitcode'] = $exception->getCode();
|
||||||
|
$return['output'] = $exception->getMessage();
|
||||||
|
$return['failed'] = true;
|
||||||
}
|
}
|
||||||
$return['failed'] = !in_array($return['exitcode'], $job['data']['response']);
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +203,6 @@ class Job extends Repository
|
||||||
} elseif (!empty($password)) {
|
} elseif (!empty($password)) {
|
||||||
$key = $password;
|
$key = $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$ssh->login($user, $key)) {
|
if (!$ssh->login($user, $key)) {
|
||||||
$return['output'] = "Login failed";
|
$return['output'] = "Login failed";
|
||||||
$return['exitcode'] = 255;
|
$return['exitcode'] = 255;
|
||||||
|
|
Loading…
Reference in New Issue