Updated and fixed cancel P2p transmission

deb-pkg
Manuel Aranda Rosales 2025-03-12 09:05:04 +01:00 committed by Nicolas Arenas
parent 9713c83f57
commit 24352cc2c8
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use App\Entity\Image;
use App\Entity\ImageImageRepository;
use App\Entity\Trace;
use App\Model\CommandTypes;
use App\Model\DeployMethodTypes;
use App\Model\TraceStatus;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
@ -52,7 +53,11 @@ class CancelTransmissionAction extends AbstractOgRepositoryController
throw new ValidatorException('Fullsum is required');
}
$content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/'.$method.'/images/'.$image->getImageFullsum());
if ($method === DeployMethodTypes::TORRENT) {
$content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/p2p');
} else {
$content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/'.$method.'/images/'.$image->getImageFullsum());
}
if (isset($content['error']) && $content['error'] === Response::HTTP_INTERNAL_SERVER_ERROR ) {
throw new ValidatorException('Error cancelling transmission');