shell: Fix $wgShellboxUrls by passing service name when creating BoxedCommand

To be able to use non-default Shellbox URLs, we need to be able to
pass in a service name when creating the ShellboxClient.

Have CommandFactory::createBoxed() take a $service parameter that can
be used to change which Shellbox will be hit, as intended.

Bug: T290193
Change-Id: Ic1671a69070f962dbb0083028faf34d6d437022a
This commit is contained in:
Kunal Mehta 2021-09-01 11:43:22 -07:00
parent 930841b4c7
commit b6d1afa1aa

View file

@ -172,12 +172,15 @@ class CommandFactory {
/**
* Instantiates a new BoxedCommand.
*
* @param ?string $service Name of Shellbox (as configured in
* $wgShellboxUrls) that should be used
* @return BoxedCommand
*/
public function createBoxed(): BoxedCommand {
if ( $this->shellboxClientFactory->isEnabled() ) {
public function createBoxed( ?string $service = null ): BoxedCommand {
if ( $this->shellboxClientFactory->isEnabled( $service ) ) {
$client = $this->shellboxClientFactory->getClient( [
'timeout' => $this->limits['walltime'] + 1
'timeout' => $this->limits['walltime'] + 1,
'service' => $service,
] );
$executor = new RemoteBoxedExecutor( $client );
$executor->setLogger( $this->logger );