Fixes for SSH key generation.

Closes #514, fixes #512
This commit is contained in:
Tobias van Beek 2014-07-21 11:26:06 +02:00 committed by Dan Cryer
parent 1f41e50639
commit 926ef097d4

View file

@ -29,7 +29,7 @@ class SshKey
mkdir($tempPath);
}
$return = array();
$return = array('private_key' => '', 'public_key' => '');
if ($this->canGenerateKeys()) {
shell_exec('ssh-keygen -q -t rsa -b 2048 -f '.$keyFile.' -N "" -C "deploy@phpci"');
@ -37,15 +37,13 @@ class SshKey
$pub = file_get_contents($keyFile . '.pub');
$prv = file_get_contents($keyFile);
if (empty($pub)) {
$pub = '';
if (!empty($pub)) {
$return['public_key'] = $pub;
}
if (empty($prv)) {
$prv = '';
if (!empty($prv)) {
$return['private_key'] = $prv;
}
$return = array('private_key' => $prv, 'public_key' => $pub);
}
return $return;