Skip to content

Commit ce284d3

Browse files
authored
Merge pull request #63 from ChlodAlejandro/master
SshCommand: Only force username when requested
2 parents 6512035 + 22a3137 commit ce284d3

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

Command/SshCommand.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,12 @@ public function __construct(ReplicasClient $client)
4646
*/
4747
protected function configure(): void
4848
{
49-
$whoAmI = new Process(['whoami']);
50-
$whoAmI->run();
51-
$username = trim($whoAmI->getOutput());
52-
5349
$this->setDescription('Create an SSH tunnel to the Toolforge replicas.');
5450
$this->setHelp('Note you must already have added your SSH key to the ssh-agent before running this.');
5551
$this->addArgument(
5652
'username',
5753
InputArgument::OPTIONAL,
58-
'Your Toolforge UNIX shell username, if different than your local username.',
59-
$username
54+
'Your Toolforge UNIX shell username, if different than your local username.'
6055
);
6156
$this->addOption(
6257
'service',
@@ -92,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9287
$bindAddress = $input->getOption('bind-address');
9388
$toolsDb = $input->getOption('toolsdb');
9489
$host = "$service".self::HOST_SUFFIX;
95-
$login = $username.'@'.self::LOGIN_URL;
90+
$login = $username ? $username.'@'.self::LOGIN_URL : self::LOGIN_URL;
9691

9792
$toolsDbStr = $toolsDb ? ' and tools'.self::HOST_SUFFIX : '';
9893
$output->writeln("Connecting to *.$host$toolsDbStr via $login... use ^C to cancel or terminate connection.");

0 commit comments

Comments
 (0)