deployimage-date #85
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -1,7 +1,15 @@
|
|||
# Changelog
|
||||
## [1.4.0] - 2026-04-08
|
||||
### Added
|
||||
- Entidad Partition: Añadido el campo deployDate expuesto mediante el DTO para registrar la fecha exacta de despliegue de imagen.
|
||||
- CreatePartitionService: Inclusión de lógica idempotente que asocia la imagen y extrae su fecha real directamente del fichero /.ogimage enviado por el cliente en el parámetro img=.
|
||||
|
||||
### Fixed
|
||||
- Limpieza explícita del deployDate (null) en caso de que el inventario no informe de fecha o haya alteraciones en el payload para evitar desincronizaciones de trazas de la imagen subyacente.
|
||||
|
||||
## [1.3.0] - 2026-03-31
|
||||
### Added
|
||||
Añadida acción Refresh para actualizar el estado de un cliente o clientes. Se actualiza su configuración de discos y se recarga el ogBrowser por si hubiese cambio del menu.
|
||||
- Añadida acción Refresh para actualizar el estado de un cliente o clientes. Se actualiza su configuración de discos y se recarga el ogBrowser por si hubiese cambio del menu.
|
||||
|
||||
## [1.2.11] - 2026-03-25
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class StatusController extends AbstractController
|
|||
const string RESTORE_IMAGE_GIT = 'RESPUESTA_RestaurarImagenGit';
|
||||
const string CONFIGURE_IMAGE = 'RESPUESTA_Configurar';
|
||||
const string HARDWARE_INVENTORY = 'RESPUESTA_InventarioHardware';
|
||||
const string REFRESH = 'RESPUESTA_Actualizar';
|
||||
const string SOFTWARE_INVENTORY = 'RESPUESTA_InventarioSoftware';
|
||||
const string RUN_SCRIPT = 'RESPUESTA_EjecutarScript';
|
||||
|
||||
|
|
@ -324,6 +325,30 @@ class StatusController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($data['nfn']) && $data['nfn'] === self::REFRESH) {
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->findOneBy(['jobId' => $data['job_id'] ?? '']);
|
||||
if ($trace) {
|
||||
$client = $trace->getClient();
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setFinishedAt(new \DateTime());
|
||||
$this->entityManager->persist($trace);
|
||||
} else {
|
||||
$clientIp = $data['iph'] ?? $request->getClientIp();
|
||||
$client = $this->entityManager->getRepository(Client::class)->findOneBy(['ip' => $clientIp]);
|
||||
}
|
||||
|
||||
if ($client) {
|
||||
$client->setStatus(ClientStatus::OG_LIVE);
|
||||
$this->entityManager->persist($client);
|
||||
|
||||
if (isset($data['cfg'])) {
|
||||
$this->createPartitionService->__invoke($data, $client);
|
||||
$this->logger->info('Partition configuration updated via RESPUESTA_Actualizar', ['job_id' => $data['job_id'] ?? 'none']);
|
||||
}
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
return new JsonResponse(data: 'Webhook finished', status: Response::HTTP_OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,13 @@ class PartitionOutput extends AbstractOutput
|
|||
)]
|
||||
public ?int $memoryUsage = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
#[ApiProperty(
|
||||
description: 'Fecha de despliegue de la imagen',
|
||||
example: '2025-01-01T00:00:00+00:00'
|
||||
)]
|
||||
public ?\DateTimeInterface $deployDate = null;
|
||||
|
||||
public function __construct(Partition $partition)
|
||||
{
|
||||
parent::__construct($partition);
|
||||
|
|
@ -94,5 +101,6 @@ class PartitionOutput extends AbstractOutput
|
|||
}
|
||||
|
||||
$this->memoryUsage = $partition->getMemoryUsage() / 100;
|
||||
$this->deployDate = $partition->getDeployDate();
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,21 @@ class Partition extends AbstractEntity
|
|||
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
|
||||
private ?ImageImageRepository $image = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $deployDate = null;
|
||||
|
||||
public function getDeployDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->deployDate;
|
||||
}
|
||||
|
||||
public function setDeployDate(?\DateTimeInterface $deployDate): static
|
||||
{
|
||||
$this->deployDate = $deployDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDiskNumber(): ?int
|
||||
{
|
||||
return $this->diskNumber;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,32 @@ class CreatePartitionService
|
|||
$partitionEntity->setOperativeSystem($operativeSystem);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($cfg['img']) && $cfg['img'] !== '') {
|
||||
$imgParts = explode(':', $cfg['img']);
|
||||
$imgName = trim($imgParts[0]);
|
||||
$imgDate = $imgParts[1] ?? null;
|
||||
|
||||
$imageImageRepository = $this->entityManager->getRepository(\App\Entity\ImageImageRepository::class)
|
||||
->findOneBy(['name' => $imgName]);
|
||||
|
||||
if ($imageImageRepository) {
|
||||
$partitionEntity->setImage($imageImageRepository);
|
||||
$partitionEntity->setDeployDate(null);
|
||||
if ($imgDate) {
|
||||
$dateObj = \DateTime::createFromFormat('YmdHi', trim($imgDate));
|
||||
if ($dateObj) {
|
||||
$partitionEntity->setDeployDate($dateObj);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$partitionEntity->setImage(null);
|
||||
$partitionEntity->setDeployDate(null);
|
||||
}
|
||||
} elseif (isset($cfg['img']) && $cfg['img'] === '') {
|
||||
$partitionEntity->setImage(null);
|
||||
$partitionEntity->setDeployDate(null);
|
||||
}
|
||||
|
||||
$partitionEntity->setClient($clientEntity);
|
||||
$partitionEntity->setDiskNumber($cfg['disk']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue