Skip to content

Commit

Permalink
StatusCheckCommand: return the exit code accordingly to global status
Browse files Browse the repository at this point in the history
  • Loading branch information
andriuspetrauskis committed May 7, 2021
1 parent b2dffc7 commit c3a1454
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Commands/StatusCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Nordsec\StatusChecker\Commands;

use Nordsec\StatusChecker\Services\StatusCheckerInterface;
use Nordsec\StatusChecker\Services\StatusCheckerService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -34,5 +35,11 @@ public function execute(InputInterface $input, OutputInterface $output)
foreach ($details as $checkerName => $status) {
$output->writeln(sprintf('%s: %s', $checkerName, $status));
}

if ($this->statusCheckerService->checkGlobalStatus() !== StatusCheckerInterface::STATUS_OK) {
return static::FAILURE;
}

return static::SUCCESS;
}
}

0 comments on commit c3a1454

Please sign in to comment.