|
7 | 7 | use Drush\Drush; |
8 | 8 | use Drush\SiteAlias\SiteAliasManagerAwareInterface; |
9 | 9 | use GuzzleHttp\Client; |
| 10 | +use Symfony\Component\HttpKernel\Kernel; |
10 | 11 | use Symfony\Component\Process\Process; |
11 | 12 | use Symfony\Component\Yaml\Yaml; |
12 | | -use \Symfony\Component\HttpKernel\Kernel; |
13 | 13 |
|
14 | 14 | /** |
15 | 15 | * Drush integration for Lagoon. |
@@ -72,7 +72,7 @@ public function __construct() { |
72 | 72 | $this->jwt_token = getenv('LAGOON_OVERRIDE_JWT_TOKEN'); |
73 | 73 | $this->projectName = $lagoonyml['project'] ?? ''; |
74 | 74 | $this->ssh_port_timeout = $lagoonyml['ssh_port_timeout'] ?? 30; |
75 | | - |
| 75 | + |
76 | 76 | // Allow environment variable overrides. |
77 | 77 | $this->api = getenv('LAGOON_OVERRIDE_API') ?: $this->api; |
78 | 78 | $this->endpoint = getenv('LAGOON_OVERRIDE_SSH') ?: $this->endpoint; |
@@ -188,33 +188,34 @@ public function getJwtToken() { |
188 | 188 | [$ssh_host, $ssh_port] = explode(":", $this->endpoint); |
189 | 189 |
|
190 | 190 | $args = [ |
191 | | - "-p", $ssh_port, |
| 191 | + "-p", $ssh_port, |
192 | 192 | "-o", "ConnectTimeout=5", |
193 | 193 | "-o", "LogLevel=FATAL", |
194 | 194 | "-o", "UserKnownHostsFile=/dev/null", |
195 | 195 | "-o", "StrictHostKeyChecking=no", |
196 | 196 | ]; |
197 | 197 |
|
198 | 198 | if ($this->sshKey) { |
199 | | - $args += ["-i", $this->sshKey]; |
| 199 | + $args += ["-i", $this->sshKey]; |
200 | 200 | } |
201 | 201 |
|
202 | 202 | $cmd = ["ssh", ...$args, "lagoon@$ssh_host", "token"]; |
203 | 203 |
|
204 | 204 | $this->logger()->debug("Retrieving token via SSH -" . implode(" ", $cmd)); |
205 | 205 | if (version_compare(Kernel::VERSION, "4.2", "<")) { |
206 | | - // Symfony >= 4.2 only allows the array form of the command parameter |
| 206 | + // Symfony >= 4.2 only allows the array form of the command parameter. |
207 | 207 | $ssh = new Process(implode(" ", $cmd)); |
208 | 208 | } |
209 | 209 | else { |
210 | 210 | $ssh = new Process($cmd); |
211 | 211 | } |
212 | 212 |
|
213 | 213 | $ssh->setTimeout($this->sshTimeout); |
214 | | - |
| 214 | + |
215 | 215 | try { |
216 | | - $ssh->mustRun(); |
217 | | - } catch (ProcessFailedException $exception) { |
| 216 | + $ssh->mustRun(); |
| 217 | + } |
| 218 | + catch (ProcessFailedException $exception) { |
218 | 219 | $this->logger->debug($ssh->getMessage()); |
219 | 220 | } |
220 | 221 |
|
|
0 commit comments