Merge pull request 'develop' (#59) from develop into main
ogcore-debian-package/pipeline/head This commit looks good Details
ogcore-debian-package/pipeline/tag This commit looks good Details

Reviewed-on: #59
pull/60/head^2 0.24.1
Manuel Aranda Rosales 2025-09-09 19:21:46 +02:00
commit cb1b8081bf
5 changed files with 25 additions and 8 deletions

View File

@ -1,4 +1,9 @@
# Changelog
## [0.24.1] - 2025-09-09
### Fixed
- Se ha corregido un error en la funcionalidad de Tareas programadas
---
## [0.24.0] - 2025-09-09
### Added
- Se ha añadido la funcionalidad/servicio para poder eliminar un repositorio GIT

View File

@ -24,6 +24,9 @@ resources:
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
order:
executionOrder: ASC
properties:
App\Entity\CommandTaskScript:
id:

View File

@ -51,7 +51,7 @@ resources:
uriTemplate: /traces/{uuid}/mark-as-success
order:
createdAt: DESC
id: DESC
properties:
App\Entity\Trace:

View File

@ -17,6 +17,7 @@ use App\Dto\Input\BootClientsInput;
use App\Dto\Output\ClientOutput;
use App\Dto\Output\PartitionOutput;
use App\Entity\Client;
use App\Model\ClientStatus;
use App\Entity\Image;
use App\Entity\ImageImageRepository;
use App\Entity\Partition;
@ -125,6 +126,10 @@ class ExecutePendingTracesCommand extends Command
throw new \Exception("No client associated with trace");
}
if ($client->getStatus() === ClientStatus::BUSY) {
throw new \Exception("Client is busy");
}
$trace->setExecutedAt(new \DateTime());
$this->entityManager->persist($trace);
$this->entityManager->flush();
@ -277,7 +282,7 @@ class ExecutePendingTracesCommand extends Command
existingTrace: $trace
);
if ($response->getStatusCode() === 200) {
if (json_decode($response->getContent(), true)['status'] === 200) {
$trace->setStatus(TraceStatus::IN_PROGRESS);
$trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace);
@ -359,7 +364,7 @@ class ExecutePendingTracesCommand extends Command
$partitionInputObj->diskNumber = $item['diskNumber'];
$partitionInputObj->partitionNumber = (int)$item['partitionNumber'];
$partitionInputObj->partitionCode = $item['partitionCode'] ?? 'LINUX';
$partitionInputObj->size = (float)($item['size'] / 1024);
$partitionInputObj->size = $item['size'];
$partitionInputObj->filesystem = $item['filesystem'] ?? 'EXT4';
$partitionInputObj->format = ($item['format'] ?? '0') === '1';
$partitions[] = $partitionInputObj;
@ -376,7 +381,7 @@ class ExecutePendingTracesCommand extends Command
try {
$response = $this->partitionAssistantAction->__invoke($partitionInput, $trace);
if ($response->getStatusCode() === 200) {
if (json_decode($response->getContent(), true)['status'] === 200) {
$trace->setStatus(TraceStatus::SUCCESS);
$trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace);
@ -412,7 +417,7 @@ class ExecutePendingTracesCommand extends Command
try {
$response = $this->runScriptAction->__invoke($commandExecuteInput, $trace);
if ($response->getStatusCode() === 200) {
if (json_decode($response->getContent(), true)['status'] === 200) {
$trace->setStatus(TraceStatus::SUCCESS);
$trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace);
@ -422,7 +427,11 @@ class ExecutePendingTracesCommand extends Command
return false;
} catch (\Exception $e) {
$this->logger->error('Error executing run script', [
'input' => $commandExecuteInput,
'client' => $client->getUuid(),
'error' => $e->getMessage()
]);
return false;
}
}
@ -447,7 +456,7 @@ class ExecutePendingTracesCommand extends Command
try {
$response = $this->rebootAction->__invoke($multipleClientsInput);
if ($response->getStatusCode() === 200) {
if (json_decode($response->getContent(), true)['status'] === 200) {
$trace->setStatus(TraceStatus::SUCCESS);
$trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace);

View File

@ -64,7 +64,7 @@ class KillJobAction extends AbstractOgAgentController
'command' => $trace->getCommand(),
];
$this->createService->__invoke($client, CommandTypes::KILL_JOB, TraceStatus::CANCELLED, $input->jobId, $inputData);
//$this->createService->__invoke($client, CommandTypes::KILL_JOB, TraceStatus::CANCELLED, $input->jobId, $inputData);
return new JsonResponse(data: $trace, status: Response::HTTP_OK);
}