Skip to content

Commit

Permalink
Merge branch 'release/3.0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
stmh committed May 1, 2019
2 parents 1450dd8 + e45bc5e commit 04aa601
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Changelog

## 3.0.7 / 2019-05-01

### Fixed

* Show a warning if local users' keyagent does not have a key when running `docker copySSHKeys`

## 3.0.6 / 2019-04-25

### Fixed

* rename setting `dockerAuthorizedKeyFile` to `dockerAuthorizedKeysFile`, keep the old one for backwards compatibility
* if no dockerAuthorizedKeysFile is set, use the public-keys of the ssh-agent instead
* Cd into siteFolder before restoring a db-dump. (Fixes #48)
Expand Down
21 changes: 14 additions & 7 deletions src/Method/DockerMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,20 @@ private function copySSHKeys(HostConfig $hostconfig, TaskContextInterface $conte
if (empty($files['/root/.ssh/authorized_keys'])) {
$file = tempnam("/tmp", "phabalicious");

$result = $shell->run(sprintf('#!ssh-add -L > %s', $file));

$files['/root/.ssh/authorized_keys'] = [
'source' => $file,
'permissions' => '600',
];
$temp_files[] = $file;
try {
$result = $shell->run(sprintf('#!ssh-add -L > %s', $file));

$files['/root/.ssh/authorized_keys'] = [
'source' => $file,
'permissions' => '600',
];
$temp_files[] = $file;
} catch (FailedShellCommandException $e) {
$context->io()->warning(sprintf(
'Could not add public key to authorized_keys-file: %s',
$e->getMessage()
));
}
}

if (count($files) > 0) {
Expand Down
8 changes: 5 additions & 3 deletions src/ShellProvider/LocalShellProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Phabalicious\Configuration\ConfigurationService;
use Phabalicious\Configuration\HostConfig;
use Phabalicious\Exception\FailedShellCommandException;
use Phabalicious\Method\TaskContextInterface;
use Phabalicious\Utilities\SetAndRestoreObjProperty;
use Phabalicious\Validation\ValidationErrorBagInterface;
Expand Down Expand Up @@ -77,7 +78,7 @@ public function createShellProcess(array $command = [], array $options = []): Pr
/**
* Setup local shell.
*
* @throws \Exception
* @throws \RuntimeException
*/
public function setup()
{
Expand All @@ -86,7 +87,7 @@ public function setup()
}

if (empty($this->hostConfig)) {
throw new \Exception('No host-config set for local shell provider');
throw new \RuntimeException('No host-config set for local shell provider');
}

$shell_executable = $this->hostConfig['shellExecutable'];
Expand Down Expand Up @@ -125,7 +126,8 @@ public function setup()
* @param bool $capture_output
* @param bool $throw_exception_on_error
* @return CommandResult
* @throws \Exception
* @throws FailedShellCommandException
* @throws \RuntimeException
*/
public function run(string $command, $capture_output = false, $throw_exception_on_error = true): CommandResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Utilities
{

const FALLBACK_VERSION = '3.0.6';
const FALLBACK_VERSION = '3.0.7';

public static function mergeData(array $data, array $override_data): array
{
Expand Down

0 comments on commit 04aa601

Please sign in to comment.