refs #1923. Fixed bug create imagen processor
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
parent
aaa8854839
commit
154472ac30
|
@ -9,6 +9,7 @@ use App\Entity\Command;
|
|||
use App\Entity\Image;
|
||||
use App\Entity\ImageImageRepository;
|
||||
use App\Entity\ImageRepository;
|
||||
use App\Entity\Partition;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\CommandTypes;
|
||||
|
@ -47,16 +48,26 @@ class CreateImageAction extends AbstractController
|
|||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(Image $image): JsonResponse
|
||||
public function __invoke(Image $image, ?Partition $partition = null): JsonResponse
|
||||
{
|
||||
if (!$image->getClient()->getIp()) {
|
||||
throw new ValidatorException('IP is required');
|
||||
}
|
||||
|
||||
$partitionInfo = json_decode($image->getPartitionInfo(), true);
|
||||
$partitionInfo = [];
|
||||
|
||||
if ($partition) {
|
||||
$partitionInfo["numPartition"] = $partition->getPartitionNumber();
|
||||
$partitionInfo["numDisk"] = $partition->getDiskNumber();
|
||||
$partitionInfo["partitionCode"] = $partition->getPartitionCode();
|
||||
$partitionInfo["filesystem"] = $partition->getFilesystem();
|
||||
$partitionInfo["osName"] = $partition->getOperativeSystem()?->getName();
|
||||
$image->setPartitionInfo(json_encode($partitionInfo));
|
||||
} else {
|
||||
$partitionInfo = json_decode($image->getPartitionInfo(), true);
|
||||
}
|
||||
|
||||
$repository = $image->getClient()->getRepository();
|
||||
|
||||
$latestImageRepo = $this->entityManager->getRepository(ImageImageRepository::class)->findLatestVersionByImageAndRepository($image, $repository);
|
||||
|
||||
$imageImageRepository = new ImageImageRepository();
|
||||
|
|
|
@ -84,7 +84,7 @@ class DeployImageAction extends AbstractController
|
|||
'par' => (string) $input->partitionNumber,
|
||||
'ifs' => "1",
|
||||
'idi' => $image->getUuid(),
|
||||
'nci' => $image->getName(),
|
||||
'nci' => $imageImageRepository->getName(),
|
||||
'ipr' => $repository->getIp(),
|
||||
'nfn' => 'RestaurarImagen',
|
||||
'ptc' => $ptcValue,
|
||||
|
|
|
@ -45,7 +45,7 @@ class TransferAction extends AbstractOgRepositoryController
|
|||
|
||||
$params = [
|
||||
'json' => [
|
||||
'image' => $image->getName().'.img',
|
||||
'image' => $imageImageRepository->getName().'.img',
|
||||
'repo_ip' => $imageImageRepository->getRepository()->getIp(),
|
||||
'user' => $repository->getUser(),
|
||||
'ssh_port' => $repository->getSshPort()
|
||||
|
|
|
@ -46,7 +46,7 @@ class TransferGlobalAction extends AbstractOgRepositoryController
|
|||
|
||||
$params = [
|
||||
'json' => [
|
||||
'image' => $image->getName().'.img',
|
||||
'image' => $imageImageRepository->getName().'.img',
|
||||
'repo_ip' => $imageImageRepository->getRepository()->getIp(),
|
||||
'user' => $repository->getUser(),
|
||||
'ssh_port' => $repository->getSshPort()
|
||||
|
|
|
@ -65,9 +65,8 @@ readonly class ImageProcessor implements ProcessorInterface
|
|||
|
||||
|
||||
if ($data->selectedImage){
|
||||
//$content = $this->renameActionController->__invoke($data->selectedImage->getEntity());
|
||||
|
||||
$response = $this->createImageActionController->__invoke($data->selectedImage->getEntity());
|
||||
$response = $this->createImageActionController->__invoke($data->selectedImage->getEntity(), $data->partition->getEntity());
|
||||
|
||||
} else {
|
||||
$image = $data->createOrUpdateEntity($entity);
|
||||
|
|
Loading…
Reference in New Issue