Compare commits
3 Commits
52455b39d8
...
93d17be4ed
Author | SHA1 | Date |
---|---|---|
|
93d17be4ed | |
|
51f968e494 | |
|
0eeb17ac67 |
|
@ -1,4 +1,9 @@
|
|||
# Changelog
|
||||
## [0.25.1] - 2025-10-01
|
||||
### Fixed
|
||||
- Se han corregido varios errores con respecto a las tareas programadas.
|
||||
|
||||
---
|
||||
## [0.25.0] - 2025-09-23
|
||||
### Added
|
||||
- Se ha añadido logica para obtener el inventario hardware de un cliente para poder almanecarlo en base de datos.
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Image;
|
||||
use App\Entity\ImageRepository;
|
||||
use App\Entity\ImageImageRepository;
|
||||
use App\Model\ImageStatus;
|
||||
use App\Repository\ImageRepository as ImageRepositoryRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'app:create-image-repositories',
|
||||
description: 'Crea una ImageRepository y/o ImageImageRepository con datos interactivos'
|
||||
)]
|
||||
class CreateImageRepositoriesCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly ImageRepositoryRepository $imageRepository
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDescription('Crea una ImageRepository y/o ImageImageRepository')
|
||||
->addArgument('action', InputArgument::OPTIONAL, 'Acción a realizar: repository, image-repository, o both', 'both')
|
||||
->addOption('repository-name', null, InputOption::VALUE_OPTIONAL, 'Nombre del repositorio de imágenes')
|
||||
->addOption('repository-ip', null, InputOption::VALUE_OPTIONAL, 'IP del repositorio de imágenes')
|
||||
->addOption('repository-user', null, InputOption::VALUE_OPTIONAL, 'Usuario del repositorio', ImageRepository::DEFAULT_USER)
|
||||
->addOption('repository-ssh-port', null, InputOption::VALUE_OPTIONAL, 'Puerto SSH del repositorio')
|
||||
->addOption('repository-comments', null, InputOption::VALUE_OPTIONAL, 'Comentarios del repositorio')
|
||||
->addOption('image-name', null, InputOption::VALUE_OPTIONAL, 'Nombre de la imagen')
|
||||
->addOption('image-type', null, InputOption::VALUE_OPTIONAL, 'Tipo de imagen', 'Server')
|
||||
->addOption('image-version', null, InputOption::VALUE_OPTIONAL, 'Versión de la imagen', '1')
|
||||
->addOption('image-repository-name', null, InputOption::VALUE_OPTIONAL, 'Nombre para ImageImageRepository')
|
||||
->addOption('image-repository-status', null, InputOption::VALUE_OPTIONAL, 'Status para ImageImageRepository', ImageStatus::SUCCESS)
|
||||
->addOption('batch', 'b', InputOption::VALUE_NONE, 'Modo no interactivo (usar solo opciones)');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$action = $input->getArgument('action');
|
||||
$batchMode = $input->getOption('batch');
|
||||
|
||||
$helper = $this->getHelper('question');
|
||||
|
||||
$output->writeln('<info>🚀 Creador de ImageRepository e ImageImageRepository</info>');
|
||||
$output->writeln('');
|
||||
|
||||
try {
|
||||
switch ($action) {
|
||||
case 'repository':
|
||||
$imageRepository = $this->createImageRepository($input, $output, $helper, $batchMode);
|
||||
$output->writeln("<success>✅ ImageRepository creado exitosamente: {$imageRepository->getName()}</success>");
|
||||
break;
|
||||
|
||||
case 'image-repository':
|
||||
$imageImageRepository = $this->createImageImageRepository($input, $output, $helper, $batchMode);
|
||||
$output->writeln("<success>✅ ImageImageRepository creado exitosamente: {$imageImageRepository->getName()}</success>");
|
||||
break;
|
||||
|
||||
case 'both':
|
||||
default:
|
||||
$output->writeln('<comment>Creando ImageRepository primero...</comment>');
|
||||
$imageRepository = $this->createImageRepository($input, $output, $helper, $batchMode);
|
||||
$output->writeln("<success>✅ ImageRepository creado: {$imageRepository->getName()}</success>");
|
||||
|
||||
$output->writeln('');
|
||||
$output->writeln('<comment>Ahora creando ImageImageRepository...</comment>');
|
||||
$imageImageRepository = $this->createImageImageRepository($input, $output, $helper, $batchMode, $imageRepository);
|
||||
$output->writeln("<success>✅ ImageImageRepository creado: {$imageImageRepository->getName()}</success>");
|
||||
break;
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
$output->writeln('');
|
||||
$output->writeln('<success>🎉 ¡Proceso completado exitosamente!</success>');
|
||||
|
||||
return Command::SUCCESS;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln("<error>❌ Error: {$e->getMessage()}</error>");
|
||||
return Command::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
private function createImageRepository(InputInterface $input, OutputInterface $output, $helper, bool $batchMode): ImageRepository
|
||||
{
|
||||
// Recopilar datos para ImageRepository
|
||||
$name = $input->getOption('repository-name');
|
||||
if (!$name && !$batchMode) {
|
||||
$question = new Question('<question>Nombre del repositorio de imágenes: </question>');
|
||||
$question->setValidator(function ($value) {
|
||||
if (empty($value)) {
|
||||
throw new \RuntimeException('El nombre no puede estar vacío');
|
||||
}
|
||||
return $value;
|
||||
});
|
||||
$name = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
$ip = $input->getOption('repository-ip');
|
||||
if (!$ip && !$batchMode) {
|
||||
$question = new Question('<question>IP del repositorio: </question>');
|
||||
$question->setValidator(function ($value) {
|
||||
if (empty($value)) {
|
||||
throw new \RuntimeException('La IP no puede estar vacía');
|
||||
}
|
||||
if (!filter_var($value, FILTER_VALIDATE_IP)) {
|
||||
throw new \RuntimeException('La IP no es válida');
|
||||
}
|
||||
return $value;
|
||||
});
|
||||
$ip = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
$user = $input->getOption('repository-user') ?: ImageRepository::DEFAULT_USER;
|
||||
if (!$batchMode) {
|
||||
$question = new Question("<question>Usuario [{$user}]: </question>", $user);
|
||||
$user = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
$sshPort = $input->getOption('repository-ssh-port');
|
||||
if (!$sshPort && !$batchMode) {
|
||||
$question = new Question('<question>Puerto SSH [22]: </question>', '22');
|
||||
$sshPort = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
$comments = $input->getOption('repository-comments');
|
||||
if (!$comments && !$batchMode) {
|
||||
$question = new Question('<question>Comentarios (opcional): </question>');
|
||||
$comments = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
// Crear ImageRepository
|
||||
$imageRepository = new ImageRepository();
|
||||
$imageRepository->setName($name);
|
||||
$imageRepository->setIp($ip);
|
||||
$imageRepository->setUser($user);
|
||||
$imageRepository->setSshPort($sshPort);
|
||||
if ($comments) {
|
||||
$imageRepository->setComments($comments);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($imageRepository);
|
||||
|
||||
return $imageRepository;
|
||||
}
|
||||
|
||||
private function createImageImageRepository(InputInterface $input, OutputInterface $output, $helper, bool $batchMode, ?ImageRepository $repository = null): ImageImageRepository
|
||||
{
|
||||
// Si no tenemos repository, necesitamos seleccionar uno existente
|
||||
if (!$repository) {
|
||||
$repositories = $this->imageRepository->findAll();
|
||||
if (empty($repositories)) {
|
||||
throw new \RuntimeException('No hay ImageRepositories disponibles. Crea uno primero.');
|
||||
}
|
||||
|
||||
if (!$batchMode) {
|
||||
$output->writeln('<comment>Repositorios disponibles:</comment>');
|
||||
foreach ($repositories as $i => $repo) {
|
||||
$output->writeln(" [{$i}] {$repo->getName()} ({$repo->getIp()})");
|
||||
}
|
||||
|
||||
$question = new Question('<question>Selecciona un repositorio (número): </question>');
|
||||
$question->setValidator(function ($value) use ($repositories) {
|
||||
if (!is_numeric($value) || !isset($repositories[$value])) {
|
||||
throw new \RuntimeException('Selección inválida');
|
||||
}
|
||||
return (int)$value;
|
||||
});
|
||||
$repoIndex = $helper->ask($input, $output, $question);
|
||||
$repository = $repositories[$repoIndex];
|
||||
} else {
|
||||
$repository = $repositories[0]; // Usar el primero disponible en modo batch
|
||||
}
|
||||
}
|
||||
|
||||
// Obtener todas las imágenes disponibles
|
||||
$images = $this->entityManager->getRepository(Image::class)->findAll();
|
||||
$image = null;
|
||||
|
||||
if (!empty($images) && !$batchMode) {
|
||||
$output->writeln('<comment>Imágenes disponibles:</comment>');
|
||||
foreach ($images as $i => $img) {
|
||||
$output->writeln(" [{$i}] {$img->getName()} (Tipo: {$img->getType()})");
|
||||
}
|
||||
$output->writeln(" [new] Crear nueva imagen");
|
||||
|
||||
$question = new Question('<question>Selecciona una imagen o "new" para crear nueva: </question>');
|
||||
$imageChoice = $helper->ask($input, $output, $question);
|
||||
|
||||
if ($imageChoice !== 'new' && is_numeric($imageChoice) && isset($images[$imageChoice])) {
|
||||
$image = $images[$imageChoice];
|
||||
}
|
||||
}
|
||||
|
||||
// Si no hay imagen seleccionada, crear una nueva
|
||||
if (!$image) {
|
||||
$imageName = $input->getOption('image-name');
|
||||
if (!$imageName && !$batchMode) {
|
||||
$question = new Question('<question>Nombre de la imagen: </question>');
|
||||
$question->setValidator(function ($value) {
|
||||
if (empty($value)) {
|
||||
throw new \RuntimeException('El nombre de la imagen no puede estar vacío');
|
||||
}
|
||||
return $value;
|
||||
});
|
||||
$imageName = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
$imageType = $input->getOption('image-type') ?: 'Server';
|
||||
if (!$batchMode) {
|
||||
$question = new Question("<question>Tipo de imagen [{$imageType}]: </question>", $imageType);
|
||||
$imageType = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
$imageVersion = $input->getOption('image-version') ?: 1;
|
||||
if (!$batchMode) {
|
||||
$question = new Question("<question>Versión de la imagen [{$imageVersion}]: </question>", $imageVersion);
|
||||
$imageVersion = (int)$helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
// Crear nueva imagen
|
||||
$image = new Image();
|
||||
$image->setName($imageName);
|
||||
$image->setType($imageType);
|
||||
$image->setVersion($imageVersion);
|
||||
$image->setRemotePc(false);
|
||||
$image->setIsGlobal(true);
|
||||
|
||||
$this->entityManager->persist($image);
|
||||
}
|
||||
|
||||
// Recopilar datos para ImageImageRepository
|
||||
$imageRepositoryName = $input->getOption('image-repository-name');
|
||||
if (!$imageRepositoryName && !$batchMode) {
|
||||
$defaultName = $image->getName() . '_' . $repository->getName();
|
||||
$question = new Question("<question>Nombre para ImageImageRepository [{$defaultName}]: </question>", $defaultName);
|
||||
$imageRepositoryName = $helper->ask($input, $output, $question);
|
||||
} elseif (!$imageRepositoryName) {
|
||||
$imageRepositoryName = $image->getName() . '_' . $repository->getName();
|
||||
}
|
||||
|
||||
$status = $input->getOption('image-repository-status') ?: ImageStatus::SUCCESS;
|
||||
if (!$batchMode) {
|
||||
$output->writeln('<comment>Status disponibles:</comment>');
|
||||
foreach (ImageStatus::getStatusKeys() as $statusKey) {
|
||||
$output->writeln(" - {$statusKey}");
|
||||
}
|
||||
$question = new Question("<question>Status [{$status}]: </question>", $status);
|
||||
$question->setValidator(function ($value) {
|
||||
if (!in_array($value, ImageStatus::getStatusKeys())) {
|
||||
throw new \RuntimeException('Status inválido');
|
||||
}
|
||||
return $value;
|
||||
});
|
||||
$status = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
// Crear ImageImageRepository
|
||||
$imageImageRepository = new ImageImageRepository();
|
||||
$imageImageRepository->setName($imageRepositoryName);
|
||||
$imageImageRepository->setImage($image);
|
||||
$imageImageRepository->setRepository($repository);
|
||||
$imageImageRepository->setStatus($status);
|
||||
$imageImageRepository->setCreated(true);
|
||||
$imageImageRepository->setVersion($image->getVersion());
|
||||
|
||||
$this->entityManager->persist($imageImageRepository);
|
||||
|
||||
return $imageImageRepository;
|
||||
}
|
||||
}
|
|
@ -223,7 +223,7 @@ class ExecutePendingTracesCommand extends Command
|
|||
|
||||
if (isset($input['action']) && $input['action'] === 'create') {
|
||||
$image = new Image();
|
||||
$image->setName($input['imageName'] ?? 'Image_' . uniqid());
|
||||
$image->setName($input['name'] );
|
||||
$image->setType($input['type'] ?? 'monolithic');
|
||||
$image->setRemotePc($input['remotePc'] ?? false);
|
||||
$image->setIsGlobal($input['isGlobal'] ?? false);
|
||||
|
@ -368,7 +368,7 @@ class ExecutePendingTracesCommand extends Command
|
|||
$partitionInputObj->partitionCode = $item['partitionCode'] ?? 'LINUX';
|
||||
$partitionInputObj->size = $item['size'];
|
||||
$partitionInputObj->filesystem = $item['filesystem'] ?? 'EXT4';
|
||||
$partitionInputObj->format = ($item['format'] ?? '0') === '1';
|
||||
$partitionInputObj->format = $item['format'] ?? false;
|
||||
$partitions[] = $partitionInputObj;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,32 +6,24 @@ namespace App\Controller;
|
|||
|
||||
use ApiPlatform\Validator\ValidatorInterface;
|
||||
use App\Dto\Input\DeployGitImageInput;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Image;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Entity\ImageImageRepository;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\Partition;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\DeployMethodTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class DeployGitImageAction extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly CreateService $createService,
|
||||
protected readonly ValidatorInterface $validator,
|
||||
protected readonly LoggerInterface $logger,
|
||||
public readonly \App\Controller\OgAgent\DeployGitImageAction $deployGitImageOgAgentAction,
|
||||
) {
|
||||
}
|
||||
|
@ -55,11 +47,25 @@ class DeployGitImageAction extends AbstractController
|
|||
$clientJobs = [];
|
||||
|
||||
foreach ($input->clients as $client) {
|
||||
$inputData = $this->createInputData($input, $client->getEntity());
|
||||
$jobId = $this->processDeployment($client->getEntity(), $input, $inputData, DeployMethodTypes::GIT);
|
||||
|
||||
if ($jobId) {
|
||||
$clientJobs[(string) '/clients/' . $client->getEntity()->getUuid()] = $jobId;
|
||||
try {
|
||||
$inputData = $this->createInputData($input, $client->getEntity());
|
||||
$jobId = $this->processDeployment($client->getEntity(), $input, $inputData, DeployMethodTypes::GIT);
|
||||
|
||||
if ($jobId) {
|
||||
$clientJobs[(string) '/clients/' . $client->getEntity()->getUuid()] = $jobId;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->warning('Error deploying git image to client', [
|
||||
'client_uuid' => $client->getEntity()->getUuid(),
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
|
||||
if ($input->queue) {
|
||||
$inputData = $this->createInputData($input, $client->getEntity());
|
||||
$this->createService->__invoke($client->getEntity(), CommandTypes::DEPLOY_IMAGE, TraceStatus::PENDING, null, $inputData);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +91,6 @@ class DeployGitImageAction extends AbstractController
|
|||
private function createInputData(DeployGitImageInput $input, $client): array
|
||||
{
|
||||
return [
|
||||
'method' => $input->method,
|
||||
'client' => $client->getUuid(),
|
||||
'hexsha' => $input->hexsha,
|
||||
'repositoryName' => $input->repositoryName,
|
||||
|
|
|
@ -6,28 +6,14 @@ namespace App\Controller\OgAgent;
|
|||
|
||||
use App\Dto\Input\CheckPartitionSizesInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Partition;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\ImageStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class CheckPartitionSizesAction extends AbstractOgAgentController
|
||||
{
|
||||
|
|
|
@ -200,7 +200,6 @@ class CreateImageAction extends AbstractOgAgentController
|
|||
if ($existingTrace) {
|
||||
$existingTrace->setStatus(TraceStatus::IN_PROGRESS);
|
||||
$existingTrace->setJobId($jobId);
|
||||
$existingTrace->setInput($inputData);
|
||||
$this->entityManager->persist($existingTrace);
|
||||
$this->entityManager->flush();
|
||||
} else {
|
||||
|
|
|
@ -6,10 +6,7 @@ namespace App\Controller\OgAgent;
|
|||
|
||||
use App\Dto\Input\DeployGitImageInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Image;
|
||||
use App\Model\ClientStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -31,7 +28,7 @@ class DeployGitImageAction extends AbstractOgAgentController
|
|||
throw new BadRequestHttpException('IP is required');
|
||||
}
|
||||
|
||||
if (!$input->hexsha && !$input->tag) {
|
||||
if (!$input->hexsha) {
|
||||
throw new BadRequestHttpException('Either hexsha or tag is required for Git image deployment');
|
||||
}
|
||||
|
||||
|
@ -51,9 +48,9 @@ class DeployGitImageAction extends AbstractOgAgentController
|
|||
'idi' => $input->repositoryName,
|
||||
'image_name' => $input->repositoryName,
|
||||
'repository' => $repository->getIp(),
|
||||
'nfn' => 'RestaurarImagenGit',
|
||||
'nfn' => 'RestaurarImagenGit',
|
||||
'ids' => '0',
|
||||
'commit' => $input->hexsha ?? $input->tag,
|
||||
'commit' => $input->hexsha,
|
||||
'branch' => $input->branch
|
||||
];
|
||||
|
||||
|
@ -71,7 +68,7 @@ class DeployGitImageAction extends AbstractOgAgentController
|
|||
$this->logger->info('Deploying Git image', [
|
||||
'repository' => $input->repositoryName,
|
||||
'branch' => $input->branch,
|
||||
'ref' => $input->hexsha ?? $input->tag,
|
||||
'ref' => $input->hexsha,
|
||||
'client' => $client->getIp()
|
||||
]);
|
||||
|
||||
|
|
|
@ -6,29 +6,15 @@ namespace App\Controller\OgAgent;
|
|||
|
||||
use App\Dto\Input\DeployImageInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\ImageImageRepository;
|
||||
use App\Entity\Partition;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\DeployMethodTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
class DeployImageAction extends AbstractOgAgentController
|
||||
{
|
||||
|
|
|
@ -6,28 +6,20 @@ namespace App\Controller\OgAgent;
|
|||
|
||||
use App\Dto\Input\PartitionPostInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Partition;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\ImageStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class PartitionAssistantAction extends AbstractOgAgentController
|
||||
{
|
||||
|
@ -130,7 +122,6 @@ class PartitionAssistantAction extends AbstractOgAgentController
|
|||
if ($existingTrace) {
|
||||
$existingTrace->setStatus(TraceStatus::IN_PROGRESS);
|
||||
$existingTrace->setJobId($jobId);
|
||||
$existingTrace->setInput($data);
|
||||
$this->entityManager->persist($existingTrace);
|
||||
$this->entityManager->flush();
|
||||
} else {
|
||||
|
|
|
@ -6,27 +6,16 @@ namespace App\Controller\OgAgent;
|
|||
|
||||
use App\Dto\Input\MultipleClientsInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Image;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\ImageStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class RebootAction extends AbstractOgAgentController
|
||||
{
|
||||
|
|
|
@ -11,7 +11,6 @@ use App\Model\TraceStatus;
|
|||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
|
|
|
@ -2,26 +2,19 @@
|
|||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Dto\Input\CommandExecuteInput;
|
||||
use App\Dto\Input\MultipleClientsInput;
|
||||
use App\Dto\Input\CommandExecuteInput;
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use App\Service\Trace\CreateService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class RunScriptAction extends AbstractOgAgentController
|
||||
{
|
||||
|
@ -170,7 +163,6 @@ class RunScriptAction extends AbstractOgAgentController
|
|||
$status = ($this->isLinuxOrWindows($client) || $this->isLinuxOrWindowsSession($client)) ? TraceStatus::SENT : TraceStatus::IN_PROGRESS;
|
||||
$trace->setStatus($status);
|
||||
$trace->setJobId($jobId);
|
||||
$trace->setInput($inputData);
|
||||
$this->entityManager->persist($trace);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class UpdateGitImageAction extends AbstractOgAgentController
|
|||
'nfn' => 'ModificarImagenGit',
|
||||
'ids' => '0',
|
||||
'branch' => $input->destinationBranch,
|
||||
'options' => $input->options ? 'force push' : null,
|
||||
'options' => $input->options ? 'force_push' : null,
|
||||
];
|
||||
|
||||
$url = 'https://'.$client->getIp().':8000/opengnsys/ModificarImagenGit';
|
||||
|
|
Loading…
Reference in New Issue