refs #1692. Import Image. Changes in logic
testing/ogcore-api/pipeline/head This commit looks good Details

pull/26/head
Manuel Aranda Rosales 2025-03-12 08:25:45 +01:00
parent 7c37bd418a
commit b9e894f2d0
1 changed files with 10 additions and 10 deletions

View File

@ -50,14 +50,22 @@ class ImportAction extends AbstractOgRepositoryController
throw new ValidatorException('This image already exists in this repository');
}
$imageImageRepositoryEntity = new ImageImageRepository();
$imageImageRepositoryEntity->setStatus(ImageStatus::AUX_FILES_PENDING);
$imageImageRepositoryEntity->setImage($imageEntity);
$imageImageRepositoryEntity->setRepository($repository);
$this->entityManager->persist($imageImageRepositoryEntity);
$this->entityManager->flush();
$this->logger->info('Creating aux files', ['image' => $image]);
$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 ) {
@ -71,14 +79,6 @@ class ImportAction extends AbstractOgRepositoryController
$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);
$imageImageRepositoryEntity->setRepository($repository);
$this->entityManager->persist($imageImageRepositoryEntity);
$this->entityManager->flush();
return new JsonResponse(data: [], status: Response::HTTP_OK);
}
}