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

Reviewed-on: #51
pull/52/head 0.22.2
Manuel Aranda Rosales 2025-09-03 17:12:02 +02:00
commit 75e54824b1
2 changed files with 46 additions and 22 deletions

View File

@ -1,4 +1,9 @@
# Changelog # Changelog
## [0.22.2] - 2025-09-03
### Fixed
- Se ha corregido un error con el particionador, en las tareas programadas.
---
## [0.22.1] - 2025-09-03 ## [0.22.1] - 2025-09-03
### Fixed ### Fixed
- Se ha corregido un typo. - Se ha corregido un typo.

View File

@ -165,15 +165,39 @@ class ExecutePendingTracesCommand extends Command
{ {
$client = $trace->getClient(); $client = $trace->getClient();
if (!isset($input['image'])) { $image = null;
throw new \Exception("Image UUID not found in trace input");
if (isset($input['action']) && $input['action'] === 'create') {
$image = new Image();
$image->setName($input['imageName'] ?? 'Image_' . uniqid());
$image->setType($input['type'] ?? 'monolithic');
$image->setRemotePc($input['remotePc'] ?? false);
$image->setIsGlobal($input['isGlobal'] ?? false);
$image->setClient($client);
$this->entityManager->persist($image);
} elseif (isset($input['action']) && $input['action'] === 'update') {
if (!isset($input['imageUuid'])) {
throw new \Exception("Image UUID not found in trace input for update operation");
}
$image = $this->entityManager->getRepository(Image::class)
->findOneBy(['uuid' => $input['imageUuid']]);
if (!$image) {
throw new \Exception("Image not found with UUID: {$input['imageUuid']} for update operation");
}
} else {
throw new \Exception("Either 'create' or 'update' field must be set to true in trace input");
} }
$image = $this->entityManager->getRepository(Image::class) if (isset($input['diskNumber']) && isset($input['partitionNumber'])) {
->findOneBy(['uuid' => $input['image']]); $partitionInfo = [
'numDisk' => $input['diskNumber'],
if (!$image) { 'numPartition' => $input['partitionNumber'],
throw new \Exception("Image not found with UUID: {$input['image']}"); 'partitionCode' => $input['partitionCode'] ?? 'LINUX',
'filesystem' => $input['filesystem'] ?? 'EXT4'
];
$image->setPartitionInfo(json_encode($partitionInfo));
} }
$partition = null; $partition = null;
@ -201,7 +225,7 @@ class ExecutePendingTracesCommand extends Command
); );
if ($response->getStatusCode() === 200) { if ($response->getStatusCode() === 200) {
$trace->setStatus(TraceStatus::SUCCESS); $trace->setStatus(TraceStatus::IN_PROGRESS);
$trace->setFinishedAt(new \DateTime()); $trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace); $this->entityManager->persist($trace);
$this->entityManager->flush(); $this->entityManager->flush();
@ -265,21 +289,16 @@ class ExecutePendingTracesCommand extends Command
$partitionInput->clients = [new ClientOutput($client)]; $partitionInput->clients = [new ClientOutput($client)];
$partitions = []; $partitions = [];
$diskNumber = 1;
foreach ($input as $item) { foreach ($input as $item) {
if (isset($item['dis'])) { $partitionInputObj = new PartitionInput();
$diskNumber = (int)$item['dis']; $partitionInputObj->diskNumber = $item['diskNumber'];
} elseif (isset($item['par'])) { $partitionInputObj->partitionNumber = (int)$item['partitionNumber'];
$partitionInputObj = new PartitionInput(); $partitionInputObj->partitionCode = $item['partitionCode'] ?? 'LINUX';
$partitionInputObj->diskNumber = $diskNumber; $partitionInputObj->size = (float)($item['size'] / 1024);
$partitionInputObj->partitionNumber = (int)$item['par']; $partitionInputObj->filesystem = $item['filesystem'] ?? 'EXT4';
$partitionInputObj->partitionCode = $item['cpt'] ?? 'LINUX'; $partitionInputObj->format = ($item['format'] ?? '0') === '1';
$partitionInputObj->size = (float)($item['tam'] / 1024); $partitions[] = $partitionInputObj;
$partitionInputObj->filesystem = $item['sfi'] ?? 'EXT4';
$partitionInputObj->format = ($item['ope'] ?? '0') === '1';
$partitions[] = $partitionInputObj;
}
} }
$partitionInput->partitions = $partitions; $partitionInput->partitions = $partitions;