pull/26/head
parent
350dcd1d24
commit
7c37bd418a
|
@ -33,26 +33,6 @@ class ImportAction extends AbstractOgRepositoryController
|
|||
{
|
||||
$image = $input->name;
|
||||
|
||||
$params = [
|
||||
'json' => [
|
||||
'image' => $image.'.img'
|
||||
]
|
||||
];
|
||||
|
||||
$this->logger->info('Creating aux files', ['image' => $image]);
|
||||
|
||||
$content = $this->createRequest('POST', 'http://'.$repository->getIp().':8006/ogrepository/v1/images/torrentsum', $params);
|
||||
|
||||
if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR ) {
|
||||
throw new ValidatorException('Error importing image');
|
||||
}
|
||||
|
||||
$inputData = [
|
||||
'imageName' => $image
|
||||
];
|
||||
|
||||
$this->createService->__invoke(null, CommandTypes::CREATE_IMAGE_AUX_FILE, TraceStatus::IN_PROGRESS, $content['job_id'], $inputData);
|
||||
|
||||
$imageEntity = $this->entityManager->getRepository(Image::class)->findOneBy(['name' => $image]);
|
||||
|
||||
if (!$imageEntity){
|
||||
|
@ -70,6 +50,27 @@ class ImportAction extends AbstractOgRepositoryController
|
|||
throw new ValidatorException('This image already exists in this repository');
|
||||
}
|
||||
|
||||
$params = [
|
||||
'json' => [
|
||||
'image' => $image.'.img'
|
||||
]
|
||||
];
|
||||
|
||||
$this->logger->info('Creating aux files', ['image' => $image]);
|
||||
|
||||
$content = $this->createRequest('POST', 'http://'.$repository->getIp().':8006/ogrepository/v1/images/torrentsum', $params);
|
||||
|
||||
if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR ) {
|
||||
throw new ValidatorException('Error importing image');
|
||||
}
|
||||
|
||||
$inputData = [
|
||||
'imageName' => $image,
|
||||
'imageUuid' => $imageImageRepositoryEntity->getUuid(),
|
||||
];
|
||||
|
||||
$this->createService->__invoke(null, CommandTypes::CREATE_IMAGE_AUX_FILE, TraceStatus::IN_PROGRESS, $content['job_id'], $inputData);
|
||||
|
||||
$imageImageRepositoryEntity = new ImageImageRepository();
|
||||
$imageImageRepositoryEntity->setStatus(ImageStatus::AUX_FILES_PENDING);
|
||||
$imageImageRepositoryEntity->setImage($imageEntity);
|
||||
|
|
Loading…
Reference in New Issue