Skip to content

Commit

Permalink
Merge pull request #107 from fortrabbit/tiny-fixes
Browse files Browse the repository at this point in the history
fix volume check
  • Loading branch information
Oliver Stark authored Apr 8, 2021
2 parents ae7df6a + 7ab2999 commit 062a4bf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.4 - 2021-04-08
- Don't throw exception if no local volumes exist
- Remove DB_TABLE_PREFIX check

## 1.0.3 - 2021-01-11
- Fixed type issue with symfony/process 5.x (use `Process::fromShellCommandline()`)

Expand Down
3 changes: 1 addition & 2 deletions src/Actions/InfoAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public function run()
$this->envRow('SECURITY_KEY', null, true),
new TableSeparator(),

$this->envRow('DB_TABLE_PREFIX'),
$this->envRow('DB_SERVER', function ($local, $remote) {
return stristr($remote, '.frbit.com');
}),
Expand Down Expand Up @@ -103,7 +102,7 @@ public function run()
);

// Error message with more instructions
$errors = array_filter(['SECURITY_KEY', 'DB_TABLE_PREFIX'], function ($key) {
$errors = array_filter(['SECURITY_KEY'], function ($key) {
return ! self::assertEquals(
$this->remoteInfo[$key],
getenv($key)
Expand Down
9 changes: 7 additions & 2 deletions src/Actions/VolumesDownAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ public function run(?string $stage = null, ?array $volumeHandles = null)
return ExitCode::UNSPECIFIED_ERROR;
}

$volumes = $this->localVolume->filterByHandle($volumeHandles);
$lastVolume = end($volumes);
try {
$volumes = $this->localVolume->filterByHandle($volumeHandles);
$lastVolume = end($volumes);
} catch (VolumeNotFound $exception) {
$this->line('No local volumes found.' . PHP_EOL);
return ExitCode::OK;
}

foreach ($volumes as $volume) {
$path = $this->prepareForRsync($volume->path);
Expand Down
10 changes: 8 additions & 2 deletions src/Actions/VolumesUpAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ public function run(?string $stage = null, ?array $volumeHandles = null)
return ExitCode::UNSPECIFIED_ERROR;
}

$volumes = $this->localVolume->filterByHandle($volumeHandles);
$lastVolume = end($volumes);
try {
$volumes = $this->localVolume->filterByHandle($volumeHandles);
$lastVolume = end($volumes);
} catch (VolumeNotFound $exception) {
$this->line('No local volumes found.' . PHP_EOL);
return ExitCode::OK;
}


foreach ($volumes as $volume) {
$path = $this->prepareForRsync($volume->path);
Expand Down

0 comments on commit 062a4bf

Please sign in to comment.