develop-jenkins
parent
f8bfffebf1
commit
d5e36c6657
|
@ -134,6 +134,7 @@ docker exec ogcore-php php bin/console opengnsys:migration:hardware-profile #car
|
|||
docker exec ogcore-php php bin/console opengnsys:migration:clients #cargamos los clientes
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:os #cargamos los sistemas operativos
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:image #cargamos las imagenes
|
||||
docker exec ogcore-php php bin/console opengnsys:migration:software-profile #cargamos los software profiles
|
||||
```
|
||||
|
||||
## Objetos de interés
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241015154123 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` CHANGE image_id image_id INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` CHANGE image_id image_id INT NOT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241016063657 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE software ADD type VARCHAR(255) NOT NULL');
|
||||
$this->addSql('ALTER TABLE software_profile ADD operative_system_id INT NOT NULL');
|
||||
$this->addSql('ALTER TABLE software_profile ADD CONSTRAINT FK_B70C3C9BF1E9F66E FOREIGN KEY (operative_system_id) REFERENCES operative_system (id)');
|
||||
$this->addSql('CREATE INDEX IDX_B70C3C9BF1E9F66E ON software_profile (operative_system_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE software DROP type');
|
||||
$this->addSql('ALTER TABLE software_profile DROP FOREIGN KEY FK_B70C3C9BF1E9F66E');
|
||||
$this->addSql('DROP INDEX IDX_B70C3C9BF1E9F66E ON software_profile');
|
||||
$this->addSql('ALTER TABLE software_profile DROP operative_system_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241016065729 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE software_profile CHANGE operative_system_id operative_system_id INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE software_profile CHANGE operative_system_id operative_system_id INT NOT NULL');
|
||||
}
|
||||
}
|
|
@ -2,9 +2,12 @@
|
|||
|
||||
namespace App\Command\Migration;
|
||||
|
||||
use App\Entity\OperativeSystem;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\Software;
|
||||
use App\Entity\SoftwareProfile;
|
||||
use App\Model\OrganizationalUnitTypes;
|
||||
use App\Model\SoftwareTypes;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
@ -24,34 +27,131 @@ class MigrateSoftwareAndSoftwareProfileCommand extends Command
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
|
||||
/** @var EntityManagerInterface $oldDatabaseEntityManager */
|
||||
$oldDatabaseEntityManager = $this->doctrine->getManager('og_1');
|
||||
|
||||
$organizationalUnitRepository = $this->entityManager->getRepository(OrganizationalUnit::class);
|
||||
$operativeSystemRepository = $this->entityManager->getRepository(OperativeSystem::class);
|
||||
$softwareProfileRepository = $this->entityManager->getRepository(SoftwareProfile::class);
|
||||
$softwareRepository = $this->entityManager->getRepository(Software::class);
|
||||
|
||||
/** Obtener los perfiles software de la base de datos antigua **/
|
||||
/** Obtener los software de la base de datos antigua **/
|
||||
$rsmSoftware = new ResultSetMapping();
|
||||
$rsmSoftware->addScalarResult('idtiposoftware', 'idtiposoftware');
|
||||
$rsmSoftware->addScalarResult('idsoftware', 'idsoftware');
|
||||
$rsmSoftware->addScalarResult('descripcion', 'descripcion');
|
||||
$rsmSoftware->addScalarResult('grupoid', 'softwares.grupoid');
|
||||
$rsmSoftware->addScalarResult('idcentro', 'softwares.idcentro');
|
||||
$rsmSoftware->addScalarResult('idtiposoftware', 'softwares.idtiposoftware');
|
||||
|
||||
$softwareQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idtiposoftware, descripcion FROM softwares', $rsmSoftware);
|
||||
$softwareQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idsoftware, softwares.idtiposoftware, softwares.descripcion, softwares.grupoid, softwares.idcentro FROM softwares ', $rsmSoftware);
|
||||
$softwareCollection = $softwareQuery->getResult();
|
||||
|
||||
foreach ($softwareCollection as $software) {
|
||||
$output->writeln("SOFTWARE TOTAL: ". count($softwareCollection));
|
||||
foreach ($softwareCollection as $software){
|
||||
$softwareEntity = null;
|
||||
$softwareEntity = $softwareRepository->findOneBy(['migrationId' => $software['idtiposoftware']]);
|
||||
if (!$softwareEntity) {
|
||||
$softwareEntity = $softwareRepository->findOneBy(['migrationId' => $software['idsoftware']]);
|
||||
if(!$softwareEntity){
|
||||
|
||||
$type = match ($software['softwares.idtiposoftware']) {
|
||||
1 => SoftwareTypes::OPERATIVE_SYSTEM,
|
||||
2 => SoftwareTypes::APPLICATION,
|
||||
3 => SoftwareTypes::FILE,
|
||||
default => SoftwareTypes::APPLICATION,
|
||||
};
|
||||
|
||||
$softwareEntity = new Software();
|
||||
$softwareEntity->setMigrationId($software['idtiposoftware']);
|
||||
$softwareEntity->setName($software['descripcion']);
|
||||
$softwareEntity->setMigrationId($software['idsoftware']);
|
||||
$softwareEntity->setDescription($software['descripcion']);
|
||||
$softwareEntity->setName($software['descripcion']);
|
||||
$softwareEntity->setType($type);
|
||||
}
|
||||
|
||||
$migrationId = match ($software['softwares.grupoid']) {
|
||||
0 => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT . '-' . $software['softwares.idcentro'],
|
||||
default => OrganizationalUnitTypes::CLASSROOMS_GROUP . '-' . $software['softwares.grupoid'],
|
||||
};
|
||||
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
/*
|
||||
if ($organizationalUnit){
|
||||
$softwareEntity->setOrganizationalUnit($organizationalUnit);
|
||||
}*/
|
||||
|
||||
$this->entityManager->persist($softwareEntity);
|
||||
}
|
||||
|
||||
/** Obtener los perfiles software de la base de datos antigua **/
|
||||
$rsmSoftwareProfiles = new ResultSetMapping();
|
||||
$rsmSoftwareProfiles->addScalarResult('idperfilsoft', 'idperfilsoft');
|
||||
$rsmSoftwareProfiles->addScalarResult('descripcion', 'descripcion');
|
||||
$rsmSoftwareProfiles->addScalarResult('comentarios', 'perfilessoft.comentarios');
|
||||
$rsmSoftwareProfiles->addScalarResult('grupoid', 'perfilessoft.grupoid');
|
||||
$rsmSoftwareProfiles->addScalarResult('idcentro', 'perfilessoft.idcentro');
|
||||
$rsmSoftwareProfiles->addScalarResult('idnombreso', 'perfilessoft.idnombreso');
|
||||
|
||||
|
||||
$softwareProfilesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idperfilsoft, descripcion, grupos.comentarios, perfilessoft.grupoid, perfilessoft.idcentro, perfilessoft.idnombreso FROM perfilessoft LEFT JOIN grupos ON perfilessoft.grupoid = grupos.idgrupo', $rsmSoftwareProfiles);
|
||||
$softwareProfiles = $softwareProfilesQuery->getResult();
|
||||
|
||||
/** Perfiles software **/
|
||||
$output->writeln("PERFILES SOFTWARE TOTAL: ". count($softwareProfiles));
|
||||
foreach ($softwareProfiles as $softwareProfile){
|
||||
$softwareProfileEntity = null;
|
||||
$softwareProfileEntity = $softwareProfileRepository->findOneBy(['migrationId' => $softwareProfile['idperfilsoft']]);
|
||||
if(!$softwareProfileEntity){
|
||||
$softwareProfileEntity = new SoftwareProfile();
|
||||
$softwareProfileEntity->setMigrationId($softwareProfile['idperfilsoft']);
|
||||
$softwareProfileEntity->setDescription($softwareProfile['descripcion']);
|
||||
$softwareProfileEntity->setComments($softwareProfile['perfilessoft.comentarios']);
|
||||
}
|
||||
|
||||
$migrationId = match ($softwareProfile['perfilessoft.grupoid']) {
|
||||
0 => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT . '-' . $softwareProfile['perfilessoft.idcentro'],
|
||||
default => OrganizationalUnitTypes::CLASSROOMS_GROUP . '-' . $softwareProfile['perfilessoft.grupoid'],
|
||||
};
|
||||
|
||||
$organizationalUnit = $organizationalUnitRepository->findOneBy(['migrationId' => $migrationId]);
|
||||
|
||||
if ($organizationalUnit){
|
||||
$softwareProfileEntity->setOrganizationalUnit($organizationalUnit);
|
||||
}
|
||||
|
||||
$operativeSystem = $operativeSystemRepository->findOneBy(['migrationId' => $softwareProfile['perfilessoft.idnombreso']]);
|
||||
|
||||
if ($operativeSystem){
|
||||
$softwareProfileEntity->setOperativeSystem($operativeSystem);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($softwareProfileEntity);
|
||||
}
|
||||
|
||||
/** Obtener los software, y asignarselos a los perfiles software **/
|
||||
$rsmSoftwareProfilesRelation = new ResultSetMapping();
|
||||
$rsmSoftwareProfilesRelation->addScalarResult('idperfilsoft', 'idperfilsoft');
|
||||
$rsmSoftwareProfilesRelation->addScalarResult('idsoftware', 'idsoftware');
|
||||
|
||||
$softwareProfilesQuery = $oldDatabaseEntityManager->createNativeQuery('SELECT idperfilsoft, idsoftware FROM perfilessoft_softwares', $rsmSoftwareProfilesRelation);
|
||||
$softwareProfileRelations = $softwareProfilesQuery->getResult();
|
||||
|
||||
$output->writeln("PERFILES SOFTWARE RELACIONES TOTAL: ". count($softwareProfileRelations));
|
||||
foreach ($softwareProfileRelations as $softwareProfileRelation){
|
||||
$softwareProfileEntity = $softwareProfileRepository->findOneBy(['migrationId' => $softwareProfileRelation['idperfilsoft']]);
|
||||
$softwareEntity = $softwareProfileRepository->findOneBy(['migrationId' => $softwareProfileRelation['idsoftware']]);
|
||||
|
||||
if ($softwareProfileEntity && $softwareEntity){
|
||||
$softwareProfileEntity->addHardwareCollection($softwareEntity);
|
||||
$this->entityManager->persist($softwareProfileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controller\OgAgent;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\OrganizationalUnit;
|
||||
use App\Entity\Partition;
|
||||
use App\Model\OrganizationalUnitTypes;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -14,8 +19,15 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||
#[AsController]
|
||||
class OgAdmClientController extends AbstractController
|
||||
{
|
||||
#[Route('/opengnsys/rest/__ogAdmClient/InclusionCliente', methods: ['POST'])]
|
||||
public function inclusionCliente(Request $request): JsonResponse
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#[Route('/opengnsys/rest/ogAdmClient/InclusionCliente', methods: ['POST'])]
|
||||
public function processClient(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
$requiredFields = ['iph', 'cfg'];
|
||||
|
@ -26,21 +38,49 @@ class OgAdmClientController extends AbstractController
|
|||
}
|
||||
}
|
||||
|
||||
$clientEntity = $this->entityManager->getRepository(Client::class)->findOneBy(['ip' => $data['iph']]);
|
||||
|
||||
if (!$clientEntity) {
|
||||
return new JsonResponse(['message' => 'Client not found'], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
foreach ($data['cfg'] as $cfg) {
|
||||
$partitionEntity = $this->entityManager->getRepository(Partition::class)
|
||||
->findOneBy(['client' => $clientEntity, 'diskNumber' => $cfg['disk'], 'partitionNumber' => $cfg['par']]);
|
||||
|
||||
if (!$partitionEntity) {
|
||||
$partitionEntity = new Partition();
|
||||
}
|
||||
|
||||
$partitionEntity->setClient($clientEntity);
|
||||
$partitionEntity->setDiskNumber($cfg['disk']);
|
||||
//$partitionEntity->setPartitionCode($cfg['codpar']);
|
||||
$partitionEntity->setPartitionNumber($cfg['par']);
|
||||
$partitionEntity->setSize($cfg['tam']);
|
||||
$partitionEntity->setMemoryUsage($cfg['uso']);
|
||||
//$partitionEntity->setFilesystem($cfg['idsistemafichero']);
|
||||
$this->entityManager->persist($partitionEntity);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
$center = $this->entityManager->getRepository(OrganizationalUnit::class)->find($clientEntity->getOrganizationalUnit()->getId());
|
||||
$root = $this->entityManager->getRepository(OrganizationalUnit::class)->getRootNodes();
|
||||
|
||||
$responseData = [
|
||||
'res' => 1,
|
||||
'ido' => $data['ido'] ?? 42,
|
||||
'npc' => $data['npc'] ?? 42,
|
||||
'che' => 42,
|
||||
'ido' => $clientEntity->getId(),
|
||||
'npc' => $clientEntity->getName(),
|
||||
'che' => 1,
|
||||
'exe' => 42,
|
||||
'ida' => $data['ida'] ?? 42,
|
||||
'idc' => $data['idc'] ?? 42,
|
||||
'ida' => $clientEntity->getOrganizationalUnit()?->getId(),
|
||||
'idc' => $root[0]->getId(),
|
||||
];
|
||||
|
||||
return new JsonResponse($responseData, Response::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/opengnsys/rest/__ogAdmClient/AutoexecCliente', methods: ['POST'])]
|
||||
#[Route('/opengnsys/rest/ogAdmClient/AutoexecCliente', methods: ['POST'])]
|
||||
public function autoexecCliente(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
|
@ -71,7 +111,7 @@ class OgAdmClientController extends AbstractController
|
|||
return new JsonResponse($responseData, Response::HTTP_OK);
|
||||
}
|
||||
|
||||
#[Route('/opengnsys/rest/__ogAdmClient/enviaArchivo', methods: ['POST'])]
|
||||
#[Route('/opengnsys/rest/ogAdmClient/enviaArchivo', methods: ['POST'])]
|
||||
public function enviaArchivo(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
|
@ -95,7 +135,7 @@ class OgAdmClientController extends AbstractController
|
|||
return new JsonResponse(['contents' => base64_encode($contents)], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
#[Route('/opengnsys/rest/__ogAdmClient/ComandosPendientes', methods: ['POST'])]
|
||||
#[Route('/opengnsys/rest/ogAdmClient/ComandosPendientes', methods: ['POST'])]
|
||||
public function comandosPendientes(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
|
@ -122,7 +162,7 @@ class OgAdmClientController extends AbstractController
|
|||
return new JsonResponse($param, Response::HTTP_OK);
|
||||
}
|
||||
|
||||
#[Route('/opengnsys/rest/__ogAdmClient/DisponibilidadComandos', methods: ['POST'])]
|
||||
#[Route('/opengnsys/rest/ogAdmClient/DisponibilidadComandos', methods: ['POST'])]
|
||||
public function disponibilidadComandos(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
|
|
|
@ -29,7 +29,8 @@ class SyncAction extends AbstractOgBootController
|
|||
{
|
||||
$content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl . '/ogboot/v1/oglives');
|
||||
|
||||
foreach ($content['installed_ogLives'] as $ogLive) {
|
||||
foreach ($content['message'] as $ogLive) {
|
||||
var_dump($ogLive);
|
||||
$ogLiveEntity = $this->entityManager->getRepository(OgLive::class)->findOneBy(['checksum' => $ogLive['id']]);
|
||||
if ($ogLiveEntity) {
|
||||
$this->extracted($ogLiveEntity, $ogLive);
|
||||
|
@ -41,7 +42,7 @@ class SyncAction extends AbstractOgBootController
|
|||
$this->entityManager->persist($ogLiveEntity);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
$this->serDefaultOgLive($content['default_oglive']);
|
||||
//$this->serDefaultOgLive($content['default_oglive']);
|
||||
|
||||
return new JsonResponse(data: $content, status: Response::HTTP_OK);
|
||||
}
|
||||
|
@ -53,11 +54,11 @@ class SyncAction extends AbstractOgBootController
|
|||
*/
|
||||
private function extracted(OgLive|null $ogLiveEntity, mixed $ogLive): void
|
||||
{
|
||||
$ogLiveEntity->setName($ogLive['filename']);
|
||||
$ogLiveEntity->setName($ogLive['directory']);
|
||||
$ogLiveEntity->setInstalled(true);
|
||||
$ogLiveEntity->setArchitecture($ogLive['architecture']);
|
||||
$ogLiveEntity->setDistribution($ogLive['distribution']);
|
||||
$ogLiveEntity->setFilename($ogLive['filename']);
|
||||
$ogLiveEntity->setFilename($ogLive['directory']);
|
||||
$ogLiveEntity->setKernel($ogLive['kernel']);
|
||||
$ogLiveEntity->setRevision($ogLive['revision']);
|
||||
$ogLiveEntity->setDirectory($ogLive['directory']);
|
||||
|
|
|
@ -18,6 +18,11 @@ final class SoftwareInput
|
|||
#[ApiProperty(description: 'The description of the software', example: "Software 1 description")]
|
||||
public ?string $description = null;
|
||||
|
||||
#[Groups(['software:write'])]
|
||||
#[ApiProperty(description: 'The type of the software', example: "Software 1 type")]
|
||||
public ?string $type = null;
|
||||
|
||||
|
||||
public function __construct(?Software $software = null)
|
||||
{
|
||||
if (!$software) {
|
||||
|
@ -26,6 +31,7 @@ final class SoftwareInput
|
|||
|
||||
$this->name = $software->getName();
|
||||
$this->description = $software->getDescription();
|
||||
$this->type = $software->getType();
|
||||
}
|
||||
|
||||
public function createOrUpdateEntity(?Software $software = null): Software
|
||||
|
@ -36,6 +42,7 @@ final class SoftwareInput
|
|||
|
||||
$software->setName($this->name);
|
||||
$software->setDescription($this->description);
|
||||
$software->setType($this->type);
|
||||
|
||||
return $software;
|
||||
}
|
||||
|
|
|
@ -12,25 +12,25 @@ class PartitionOutput extends AbstractOutput
|
|||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?int $diskNumber = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
public ?string $partitionNumber = null;
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?int $partitionNumber = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?string $partitionCode = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?int $size = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?string $cacheContent = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?string $filesystem = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?OperativeSystemOutput $operativeSystem = null;
|
||||
|
||||
#[Groups(['partition:read'])]
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
public ?int $memoryUsage = null;
|
||||
|
||||
public function __construct(Partition $partition)
|
||||
|
|
|
@ -16,6 +16,9 @@ final class SoftwareOutput extends AbstractOutput
|
|||
#[Groups(['software:read'])]
|
||||
public ?string $description = '';
|
||||
|
||||
#[Groups(['software:read'])]
|
||||
public ?string $type = '';
|
||||
|
||||
#[Groups(['software:read'])]
|
||||
public \DateTime $createdAt;
|
||||
|
||||
|
@ -28,6 +31,7 @@ final class SoftwareOutput extends AbstractOutput
|
|||
|
||||
$this->name = $software->getName();
|
||||
$this->description = $software->getDescription();
|
||||
$this->type = $software->getType();
|
||||
$this->createdAt = $software->getCreatedAt();
|
||||
$this->createdBy = $software->getCreatedBy();
|
||||
}
|
||||
|
|
|
@ -35,10 +35,11 @@ class Partition extends AbstractEntity
|
|||
private ?int $memoryUsage = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partitions')]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?OperativeSystem $operativeSystem = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'partitions')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?Image $image = null;
|
||||
|
||||
public function getDiskNumber(): ?int
|
||||
|
|
|
@ -21,6 +21,9 @@ class Software extends AbstractEntity
|
|||
#[ORM\ManyToMany(targetEntity: SoftwareProfile::class, mappedBy: 'softwareCollection')]
|
||||
private Collection $softwareProfiles;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $type = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
@ -66,4 +69,16 @@ class Software extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(string $type): static
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@ class SoftwareProfile extends AbstractEntity
|
|||
#[ORM\ManyToMany(targetEntity: Software::class, inversedBy: 'softwareProfiles')]
|
||||
private Collection $softwareCollection;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?OperativeSystem $operativeSystem = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
@ -97,4 +101,16 @@ class SoftwareProfile extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOperativeSystem(): ?OperativeSystem
|
||||
{
|
||||
return $this->operativeSystem;
|
||||
}
|
||||
|
||||
public function setOperativeSystem(?OperativeSystem $operativeSystem): static
|
||||
{
|
||||
$this->operativeSystem = $operativeSystem;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ final class SoftwareFactory extends ModelFactory
|
|||
return [
|
||||
'createdAt' => self::faker()->dateTime(),
|
||||
'name' => self::faker()->text(255),
|
||||
'type' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ final class SoftwareProfileFactory extends ModelFactory
|
|||
'createdAt' => self::faker()->dateTime(),
|
||||
'description' => self::faker()->text(255),
|
||||
'updatedAt' => self::faker()->dateTime(),
|
||||
'operativeSystem' => OperativeSystemFactory::createOne()->_save(),
|
||||
'organizationalUnit' => OrganizationalUnitFactory::createOne(['type' => OrganizationalUnitTypes::ORGANIZATIONAL_UNIT])->_save(),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface
|
|||
));
|
||||
$openApi
|
||||
->getPaths()
|
||||
->addPath('/opengnsys/rest/__ogAdmClient/InclusionCliente', (new Model\PathItem())->withPost(
|
||||
->addPath('/opengnsys/rest/ogAdmClient/InclusionCliente', (new Model\PathItem())->withPost(
|
||||
(new Model\Operation('postInclusionCliente'))
|
||||
->withTags(['OgLive agent'])
|
||||
->withSummary('Add client to the list of known ones')
|
||||
|
@ -324,7 +324,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface
|
|||
));
|
||||
$openApi
|
||||
->getPaths()
|
||||
->addPath('/opengnsys/rest/__ogAdmClient/AutoexecCliente', (new Model\PathItem())->withPost(
|
||||
->addPath('/opengnsys/rest/ogAdmClient/AutoexecCliente', (new Model\PathItem())->withPost(
|
||||
(new Model\Operation('postAutoexecCliente'))
|
||||
->withTags(['OgLive agent'])
|
||||
->withSummary('Create and return autoexec file for client')
|
||||
|
@ -403,7 +403,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface
|
|||
));
|
||||
$openApi
|
||||
->getPaths()
|
||||
->addPath('/opengnsys/rest/__ogAdmClient/enviaArchivo', (new Model\PathItem())->withPost(
|
||||
->addPath('/opengnsys/rest/ogAdmClient/enviaArchivo', (new Model\PathItem())->withPost(
|
||||
(new Model\Operation('postEnviaArchivo'))
|
||||
->withTags(['OgLive agent'])
|
||||
->withSummary('Send the contents of a file')
|
||||
|
@ -489,7 +489,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface
|
|||
));
|
||||
$openApi
|
||||
->getPaths()
|
||||
->addPath('/opengnsys/rest/__ogAdmClient/ComandosPendientes', (new Model\PathItem())->withPost(
|
||||
->addPath('/opengnsys/rest/ogAdmClient/ComandosPendientes', (new Model\PathItem())->withPost(
|
||||
(new Model\Operation('postComandosPendientes'))
|
||||
->withTags(['OgLive agent'])
|
||||
->withSummary('Retrieve pending commands for a client')
|
||||
|
@ -578,7 +578,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface
|
|||
));
|
||||
$openApi
|
||||
->getPaths()
|
||||
->addPath('/opengnsys/rest/__ogAdmClient/DisponibilidadComandos', (new Model\PathItem())->withPost(
|
||||
->addPath('/opengnsys/rest/ogAdmClient/DisponibilidadComandos', (new Model\PathItem())->withPost(
|
||||
(new Model\Operation('postDisponibilidadComandos'))
|
||||
->withTags(['OgLive agent'])
|
||||
->withSummary('Check command availability for a client')
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Entity\Software;
|
|||
use App\Factory\OrganizationalUnitFactory;
|
||||
use App\Factory\SoftwareFactory;
|
||||
use App\Factory\UserFactory;
|
||||
use App\Model\SoftwareTypes;
|
||||
use App\Model\UserGroupPermissions;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||
|
@ -59,6 +60,7 @@ class SoftwareTest extends AbstractTest
|
|||
|
||||
$this->createClientWithCredentials()->request('POST', '/software',['json' => [
|
||||
'name' => self::SW_CREATE,
|
||||
'type' => SoftwareTypes::FILE
|
||||
]]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(201);
|
||||
|
@ -66,7 +68,8 @@ class SoftwareTest extends AbstractTest
|
|||
$this->assertJsonContains([
|
||||
'@context' => '/contexts/SoftwareOutput',
|
||||
'@type' => 'Software',
|
||||
'name' => self::SW_CREATE
|
||||
'name' => self::SW_CREATE,
|
||||
'type' => SoftwareTypes::FILE
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue