Skip to content

Commit

Permalink
CLI-713: Fixes #875: Apache access logstream failing
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored and grasmash committed Apr 8, 2022
1 parent e98ba80 commit 36cb58f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/Command/App/LogTailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ protected function configure() {
* @return int 0 if everything went fine, or an exit code
* @throws \Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$environment_id = $this->determineCloudEnvironment();
$acquia_cloud_client = $this->cloudApiClientService->getClient();
$logs = $this->promptChooseLogs($acquia_cloud_client, $environment_id);
$log_types = array_map(function ($log) {
return $log->type;
$logs = $this->promptChooseLogs();
$log_types = array_map(static function ($log) {
return $log['type'];
}, $logs);
$logs_resource = new Logs($acquia_cloud_client);
$stream = $logs_resource->stream($environment_id);
Expand Down
20 changes: 7 additions & 13 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use AcquiaCloudApi\Endpoints\Applications;
use AcquiaCloudApi\Endpoints\Environments;
use AcquiaCloudApi\Endpoints\Ides;
use AcquiaCloudApi\Endpoints\Logs;
use AcquiaCloudApi\Endpoints\Subscriptions;
use AcquiaCloudApi\Response\ApplicationResponse;
use AcquiaCloudApi\Response\EnvironmentResponse;
Expand All @@ -41,11 +40,9 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
Expand Down Expand Up @@ -551,18 +548,15 @@ protected function promptChooseEnvironment(
/**
* Prompts the user to choose from a list of logs for a given Cloud Platform environment.
*
* @param Client $acquia_cloud_client
* @param string $environment_id
*
* @return null|object|array
*/
protected function promptChooseLogs(
Client $acquia_cloud_client,
string $environment_id
) {
$logs_resource = new Logs($acquia_cloud_client);
$logs = $logs_resource->getAll($environment_id);

protected function promptChooseLogs() {
$logs = array_map(static function ($log_type, $log_label) {
return [
'type' => $log_type,
'label' => $log_label,
];
}, array_keys(LogstreamManager::AVAILABLE_TYPES), LogstreamManager::AVAILABLE_TYPES);
return $this->promptChooseFromObjectsOrArrays(
$logs,
'type',
Expand Down

0 comments on commit 36cb58f

Please sign in to comment.