From 32b225c662bf5dea004f56ff934e1bf1ff136901 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Tue, 15 Oct 2024 14:38:00 +0100 Subject: [PATCH] Re-allow output from "ssh-cert:load --refresh-only", now that quiet mode works (#1491) This partially reverts 29a92850a2ce8a4f583e23bba75dcf1fdaad44c3 --- src/Command/SshCert/SshCertLoadCommand.php | 10 ++++------ src/Service/SshConfig.php | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Command/SshCert/SshCertLoadCommand.php b/src/Command/SshCert/SshCertLoadCommand.php index 3c6e66900d..382da202bc 100644 --- a/src/Command/SshCert/SshCertLoadCommand.php +++ b/src/Command/SshCert/SshCertLoadCommand.php @@ -14,9 +14,7 @@ protected function configure() { $this ->setName('ssh-cert:load') - ->addOption('refresh-only', null, InputOption::VALUE_NONE, - 'Only refresh the certificate, if necessary (do not write SSH config).' - . ' Unless verbose mode is used, this will not output messages.') + ->addOption('refresh-only', null, InputOption::VALUE_NONE, 'Only refresh the certificate, if necessary (do not write SSH config)') ->addOption('new', null, InputOption::VALUE_NONE, 'Force the certificate to be refreshed') ->addOption('new-key', null, InputOption::VALUE_NONE, 'Force a new key pair to be generated') ->setDescription('Generate an SSH certificate'); @@ -47,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $refresh = true; if (getenv(Ssh::SSH_NO_REFRESH_ENV_VAR)) { - if ($refreshOnly && !$this->stdErr->isVerbose()) { + if ($refreshOnly && $this->stdErr->isQuiet()) { return 0; } $this->stdErr->writeln(sprintf('Not refreshing SSH certificate (%s variable is set)', Ssh::SSH_NO_REFRESH_ENV_VAR)); @@ -58,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) && !$input->getOption('new') && !$input->getOption('new-key') && $certifier->isValid($sshCert)) { - if ($refreshOnly && !$this->stdErr->isVerbose()) { + if ($refreshOnly && $this->stdErr->isQuiet()) { return 0; } $this->stdErr->writeln('A valid SSH certificate exists'); @@ -73,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$sshConfig->checkRequiredVersion()) { return 1; } - if ($refreshOnly && !$this->stdErr->isVerbose()) { + if ($refreshOnly && $this->stdErr->isQuiet()) { $certifier->generateCertificate($sshCert, $input->getOption('new-key')); return 0; } diff --git a/src/Service/SshConfig.php b/src/Service/SshConfig.php index 61ee0170f4..04445cc8b0 100644 --- a/src/Service/SshConfig.php +++ b/src/Service/SshConfig.php @@ -96,7 +96,7 @@ public function configureSessionSsh() $certificate = $this->certifier->getExistingCertificate(); if ($certificate) { $executable = $this->config->get('application.executable'); - $refreshCommand = sprintf('%s ssh-cert:load --refresh-only --yes', $executable); + $refreshCommand = sprintf('%s ssh-cert:load --refresh-only --yes --quiet', $executable); // On shells where it might work (POSIX compliant), skip refreshing // the certificate when the CLI_SSH_NO_REFRESH env var is set to 1.