Merge branch 'develop' into hotfix-hw
testing/ogcore-api/pipeline/pr-develop Build started...
Details
testing/ogcore-api/pipeline/pr-develop Build started...
Details
commit
0363afb170
|
|
@ -37,7 +37,7 @@ class RunScriptAction extends AbstractOgAgentController
|
|||
throw new BadRequestHttpException('IP is required');
|
||||
}
|
||||
|
||||
$data = $this->buildRequestData($client, $input->script);
|
||||
$data = $this->buildRequestData($client, $input->script, $input->runAsAdmin);
|
||||
$response = $this->executeScript($client, $data);
|
||||
|
||||
if (isset($response['code']) && $response['code'] === 409) {
|
||||
|
|
@ -58,21 +58,14 @@ class RunScriptAction extends AbstractOgAgentController
|
|||
return new JsonResponse(data: $clientJobs, status: Response::HTTP_OK);
|
||||
}
|
||||
|
||||
private function buildRequestData(Client $client, string $script): array
|
||||
private function buildRequestData(Client $client, string $script, bool $runAsAdmin = false): array
|
||||
{
|
||||
$scriptBase64 = base64_encode($script);
|
||||
|
||||
if ($this->isLinuxOrWindows($client)) {
|
||||
if ($this->isLinuxOrWindows($client) || $this->isLinuxOrWindowsSession($client)) {
|
||||
return [
|
||||
'script' => $scriptBase64,
|
||||
'client' => 'false'
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->isLinuxOrWindowsSession($client)) {
|
||||
return [
|
||||
'script' => $scriptBase64,
|
||||
'client' => 'true'
|
||||
'client' => $runAsAdmin ? 'false' : 'true'
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,4 +34,11 @@ final class CommandExecuteInput
|
|||
example: false
|
||||
)]
|
||||
public bool $queue = false;
|
||||
|
||||
#[Groups(['command:write'])]
|
||||
#[ApiProperty(
|
||||
description: 'Si ejecutar el script en modo administrador',
|
||||
example: false
|
||||
)]
|
||||
public bool $runAsAdmin = false;
|
||||
}
|
||||
Loading…
Reference in New Issue