Jelajahi Sumber

FD3-800 when the status or the host type of a host or subnet has changed, the host reservations are free

Guillermo Espinoza 6 tahun lalu
induk
melakukan
2ffa3cba15

+ 2 - 0
src/HostBundle/EventListener/HostStatusChangeSubscriber.php

@@ -71,7 +71,9 @@ class HostStatusChangeSubscriber implements EventSubscriber
                 // invalidating the host lease
                 $lease4 = $leaseService->invalidate($entity->getMac());
                 $flashbag->add("success", $translator->trans('host.lease.invalidate.ok', ['%hwaddr%' => $entity->getMac()], 'KeaBundle'));
+            }
 
+            if ($entity instanceof Host && (isset($changeset['state']) || isset($changeset['hostType']))) {
                 // setting fixed address to null
                 if ($updateFixedAddress == true && $entity->getFixedAddress() != '') {
                     $entity->setFixedAddress(null);

+ 0 - 5
src/IPv4Bundle/EventListener/SubnetStatusOrHostTypeChangeSubscriber.php

@@ -68,11 +68,6 @@ class SubnetStatusOrHostTypeChangeSubscriber implements EventSubscriber
             $entity = $args->getEntity();
             $changeset = $uow->getEntityChangeSet($entity);
             if ($entity instanceof SubNet && (isset($changeset['status']) || isset($changeset['allowedHostType']))) {
-                // $leaseService = $this->serviceContainer->get('kea.lease.service');
-                // // invalidating the host lease
-                // $lease4 = $leaseService->invalidate($entity->getMac());
-                // $flashbag->add("success", $translator->trans('host.lease.invalidate.ok', ['%hwaddr%' => $entity->getMac()], 'KeaBundle'));
-
                 // setting fixed address to null to all hosts in the pools static associated to the subnet
                 $ipRange = $this->serviceContainer->get('pool_ipv4_service')->getStaticPoolIPRangeBySubnet($entity);
                 $hosts = [];