Corregida la propagación de parametros de OUs #100

Merged
jmbardallo merged 1 commits from propagate-network-settings into main 2026-05-04 09:17:25 +02:00
5 changed files with 69 additions and 12 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## [1.7.0] - 2026-84-28
## [1.7.1] - 2026-05-04
### Fixed
- Corregido bug en la propagación de parametros de las OU, se propagaban parametros de hijos a padres.
- Corregido también bug en la propagación de la interfaz de red a los clientes de una OU
## [1.7.0] - 2026-04-28
### Added
- Añadido endpoint para consultar y mostrar versiones de los distintos paquetes de Opengnsys
- Sondeo del estado de las aulas

View File

@ -48,7 +48,8 @@ class PropagateNetworkSettingsAction extends AbstractController
$client->setBootServer($networkSettings->getBootServer());
$client->setOgLive($networkSettings->getOgLive());
$client->setTemplate($networkSettings->getPxeTemplate());
$client->setEthernet($networkSettings->getEthernet());
$client->setResolution($networkSettings->getResolution());
$client->setNetiface($networkSettings->getNetiface());
}
$this->entityManager->flush();

View File

@ -34,6 +34,12 @@ abstract class AbstractEntity
$this->uuid = Uuid::uuid7();
}
public function __clone()
{
$this->id = null;
$this->uuid = Uuid::uuid7();
}
public function getId(): ?int
{
return $this->id;

View File

@ -93,6 +93,38 @@ class NetworkSettings extends AbstractEntity
$this->organizationalUnits = new ArrayCollection();
}
public function __clone()
{
parent::__clone();
$this->organizationalUnits = new ArrayCollection();
}
public function copyFrom(NetworkSettings $source): void
{
$this->nextServer = $source->getNextServer();
$this->bootFileName = $source->getBootFileName();
$this->proxy = $source->getProxy();
$this->dns = $source->getDns();
$this->netmask = $source->getNetmask();
$this->router = $source->getRouter();
$this->ntp = $source->getNtp();
$this->netiface = $source->getNetiface();
$this->p2pTime = $source->getP2pTime();
$this->p2pMode = $source->getP2pMode();
$this->mcastIp = $source->getMcastIp();
$this->mcastSpeed = $source->getMcastSpeed();
$this->mcastMode = $source->getMcastMode();
$this->mcastPort = $source->getMcastPort();
$this->resolution = $source->getResolution();
$this->menu = $source->getMenu();
$this->hardwareProfile = $source->getHardwareProfile();
$this->repository = $source->getRepository();
$this->ogLive = $source->getOgLive();
$this->ogShare = $source->getOgShare();
$this->pxeTemplate = $source->getPxeTemplate();
$this->bootServer = $source->getBootServer();
}
public function getNextServer(): ?string
{
return $this->nextServer;

View File

@ -335,17 +335,29 @@ class OrganizationalUnit extends AbstractEntity
public function updateNetworkSettingsRecursively(?NetworkSettings $networkSettings): void
{
$this->setNetworkSettings($networkSettings);
if ($networkSettings === null) {
$this->setNetworkSettings(null);
} else {
$currentSettings = $this->getNetworkSettings();
if ($currentSettings === null || $currentSettings === $networkSettings) {
$this->setNetworkSettings(clone $networkSettings);
} else {
$currentSettings->copyFrom($networkSettings);
}
}
/** @var Client $client */
foreach ($this->getClients() as $client) {
$client->setMenu($networkSettings->getMenu());
$client->setHardwareProfile($networkSettings->getHardwareProfile());
$client->setRepository($networkSettings->getRepository());
$client->setBootServer($networkSettings->getBootServer());
$client->setOgLive($networkSettings->getOgLive());
$client->setTemplate($networkSettings->getPxeTemplate());
$client->setResolution($networkSettings->getResolution());
if ($networkSettings !== null) {
/** @var Client $client */
foreach ($this->getClients() as $client) {
$client->setMenu($networkSettings->getMenu());
$client->setHardwareProfile($networkSettings->getHardwareProfile());
$client->setRepository($networkSettings->getRepository());
$client->setBootServer($networkSettings->getBootServer());
$client->setOgLive($networkSettings->getOgLive());
$client->setTemplate($networkSettings->getPxeTemplate());
$client->setResolution($networkSettings->getResolution());
$client->setNetiface($networkSettings->getNetiface());
}
}
foreach ($this->getOrganizationalUnits() as $childUnit) {