Updated and fixed cancel P2p transmission
parent
9713c83f57
commit
24352cc2c8
|
@ -8,6 +8,7 @@ use App\Entity\Image;
|
||||||
use App\Entity\ImageImageRepository;
|
use App\Entity\ImageImageRepository;
|
||||||
use App\Entity\Trace;
|
use App\Entity\Trace;
|
||||||
use App\Model\CommandTypes;
|
use App\Model\CommandTypes;
|
||||||
|
use App\Model\DeployMethodTypes;
|
||||||
use App\Model\TraceStatus;
|
use App\Model\TraceStatus;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
@ -52,7 +53,11 @@ class CancelTransmissionAction extends AbstractOgRepositoryController
|
||||||
throw new ValidatorException('Fullsum is required');
|
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 ) {
|
if (isset($content['error']) && $content['error'] === Response::HTTP_INTERNAL_SERVER_ERROR ) {
|
||||||
throw new ValidatorException('Error cancelling transmission');
|
throw new ValidatorException('Error cancelling transmission');
|
||||||
|
|
Loading…
Reference in New Issue